2024-12-10 06:57:53 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class CharacterClick : MonoBehaviour
|
|
|
|
|
{
|
2024-12-10 07:32:01 +08:00
|
|
|
|
public Role role;
|
|
|
|
|
|
2024-12-13 08:48:10 +08:00
|
|
|
|
public Character MyCharacter=null;
|
2024-12-10 07:32:01 +08:00
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>")] public GameObject panelPrefab;
|
2024-12-13 08:48:10 +08:00
|
|
|
|
|
2024-12-13 22:29:17 +08:00
|
|
|
|
public WaveData MyWaveData=null;
|
2024-12-13 08:48:10 +08:00
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-12-13 22:29:17 +08:00
|
|
|
|
IdForInfo(transform.GetComponent<enemy>().enemyId);
|
2024-12-13 08:48:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-10 06:57:53 +08:00
|
|
|
|
private void OnMouseDown()
|
|
|
|
|
{
|
2024-12-10 09:14:54 +08:00
|
|
|
|
// ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD> Trigger <20><><EFBFBD><EFBFBD>
|
|
|
|
|
Collider2D parentCollider = GetComponent<Collider2D>();
|
|
|
|
|
if (parentCollider != null && parentCollider.isTrigger)
|
|
|
|
|
{
|
2024-12-12 17:05:28 +08:00
|
|
|
|
// parentCollider.enabled = true;
|
2024-12-10 09:14:54 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8>ڵ<EFBFBD>
|
|
|
|
|
Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
|
|
|
|
RaycastHit2D hit = Physics2D.Raycast(mousePosition, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
if (hit.collider != null && hit.collider.gameObject == gameObject)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><CBB8>ڵ<EFBFBD>");
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ﴦ<EFBFBD><EFB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
2024-12-12 17:05:28 +08:00
|
|
|
|
GameObject instantiatedPanel= GameObject.Instantiate(panelPrefab, GameObject.Find("Canvas").transform);
|
|
|
|
|
RectTransform panelRect = instantiatedPanel.GetComponent<RectTransform>();
|
|
|
|
|
// ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD>岻<EFBFBD>ᵲס<E1B5B2><D7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
panelRect.SetAsLastSibling(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD> Canvas <20>㼶<EFBFBD><E3BCB6><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>
|
2024-12-13 22:29:17 +08:00
|
|
|
|
if (role.camp==Camp.Enemy)
|
|
|
|
|
{
|
|
|
|
|
//string eveText,string name,string def,string speed,string shanghai,string info,int hp,int maxHp
|
|
|
|
|
panelRect.GetComponent<charainfoPanel>().UpDateShow("1", "Enemy_002","0","3","1","<22><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>һ",role.hp,100f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
panelRect.GetComponent<charainfoPanel>().UpDateShow("1", MyCharacter.Name, MyCharacter.Info, MyCharacter.MaxAttack + "~" + MyCharacter.MinAttack, MyCharacter.AttackRange, MyCharacter.AttackCD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-13 08:48:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IdForInfo(string id)
|
|
|
|
|
{
|
|
|
|
|
List<Character> mY = MengyaoInfo.Instance.m_Mengyao;
|
|
|
|
|
foreach (Character temp in mY)
|
|
|
|
|
{
|
|
|
|
|
if (temp.Id==id)
|
|
|
|
|
{
|
|
|
|
|
MyCharacter=temp;
|
|
|
|
|
break;
|
2024-12-10 09:14:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-10 06:57:53 +08:00
|
|
|
|
}
|
|
|
|
|
}
|