public override void Act(BaseFSM FSM) { if (BagManager.Instance.skillAttributesList[0].skillInfo != BagManager.Instance.NullInfo) { if (BagManager.Instance.skillAttributesList[0].skillInfo.magicProperties.magicType == MagicType.Ripple) { if (BagManager.Instance.skillAttributesList[0].isOn) { BagManager.Instance.UseMagic(0); FSM.PlayAnimation("Magic Shoot Attack"); GameObject go = NetPoolManager.Instantiate("Ripple", GameTool.FindTheChild(FSM.gameObject, "RigLArmPalmGizmo").position, FSM.transform.rotation); AudioManager.PlaySound2D("Ripple").Play(); go.GetComponent <MagicBehaviour>().isHit = true; } } } if (BagManager.Instance.skillAttributesList[1].skillInfo != BagManager.Instance.NullInfo) { if (BagManager.Instance.skillAttributesList[1].skillInfo.magicProperties.magicType == MagicType.Ripple) { if (BagManager.Instance.skillAttributesList[1].isOn) { BagManager.Instance.UseMagic(1); FSM.PlayAnimation("Magic Shoot Attack"); GameObject go = NetPoolManager.Instantiate("Ripple", GameTool.FindTheChild(FSM.gameObject, "RigLArmPalmGizmo").position, FSM.transform.rotation); AudioManager.PlaySound2D("Ripple").Play(); go.GetComponent <MagicBehaviour>().isHit = true; } } } }
public override void Act(BaseFSM FSM) { //MessageCenter.AddListener(EMessageType.GetHitPoint, (object obj) => { hitpoint = (Vector3)obj; }); if (BagManager.Instance.skillAttributesList[0].skillInfo != BagManager.Instance.NullInfo) { if (BagManager.Instance.skillAttributesList[0].skillInfo.magicProperties.magicType == MagicType.Thunderbolt) { if (BagManager.Instance.skillAttributesList[0].isOn) { BagManager.Instance.UseMagic(0); GameObject go = NetPoolManager.Instantiate("ThunderBolt", FSM.transform.position + FSM.transform.forward * 5, FSM.transform.rotation); AudioManager.PlaySound2D("ThunderBolt").Play(); go.GetComponent <MagicBehaviour>().isHit = true; NetworkManager.SendPlayerMagic("ThunderBolt", GameTool.FindTheChild(FSM.gameObject, "RigLArmPalmGizmo").position, FSM.transform.rotation); } } } if (BagManager.Instance.skillAttributesList[1].skillInfo != BagManager.Instance.NullInfo) { if (BagManager.Instance.skillAttributesList[1].skillInfo.magicProperties.magicType == MagicType.Thunderbolt) { if (BagManager.Instance.skillAttributesList[1].isOn) { BagManager.Instance.UseMagic(1); GameObject go = NetPoolManager.Instantiate("ThunderBolt", FSM.transform.position + FSM.transform.forward * 5, FSM.transform.rotation); AudioManager.PlaySound2D("ThunderBolt").Play(); go.GetComponent <MagicBehaviour>().isHit = true; NetworkManager.SendPlayerMagic("ThunderBolt", GameTool.FindTheChild(FSM.gameObject, "RigLArmPalmGizmo").position, FSM.transform.rotation); } } } }
private void CreatePool(int num) { ResourcesManager.Instance.LoadMagic_sync(); foreach (KeyValuePair <string, GameObject> go in ResourcesManager.Dict_Magic) { NetPoolManager.InitPrefab(go.Value, num); } }
/// <summary> /// 魔法回调 /// </summary> /// <param name="protocol"></param> private void OnPlayerMagicBack(BaseProtocol protocol) { BytesProtocol p = protocol as BytesProtocol; int startIndex = 0; p.GetString(startIndex, ref startIndex); string MagicName = p.GetString(startIndex, ref startIndex); float posX = p.GetFloat(startIndex, ref startIndex); float posY = p.GetFloat(startIndex, ref startIndex); float posZ = p.GetFloat(startIndex, ref startIndex); float rotX = p.GetFloat(startIndex, ref startIndex); float rotY = p.GetFloat(startIndex, ref startIndex); float rotZ = p.GetFloat(startIndex, ref startIndex); NetPoolManager.Instantiate(MagicName, new Vector3(posX, posY, posZ), Quaternion.Euler(rotX, rotY, rotZ)); }
void Start() { NetPoolManager = new NetPoolManager(); Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)); if (Physics.Raycast(ray, out hitInfo)) { targetPoint = hitInfo.point; Debug.Log(hitInfo.collider); } else { targetPoint = Camera.main.transform.forward * 100; } transform.LookAt(targetPoint); }
/// <summary> /// 魔法回调 /// </summary> /// <param name="protocol"></param> private void OnPlayerMagicBack(BaseProtocol protocol) { BytesProtocol p = protocol as BytesProtocol; RaycastHit hitInfo; Vector3 targetPoint; int startIndex = 0; p.GetString(startIndex, ref startIndex); string MagicName = p.GetString(startIndex, ref startIndex); float posX = p.GetFloat(startIndex, ref startIndex); float posY = p.GetFloat(startIndex, ref startIndex); float posZ = p.GetFloat(startIndex, ref startIndex); float rotX = p.GetFloat(startIndex, ref startIndex); float rotY = p.GetFloat(startIndex, ref startIndex); float rotZ = p.GetFloat(startIndex, ref startIndex); GameObject go = NetPoolManager.Instantiate(MagicName, new Vector3(posX, posY, posZ), Quaternion.Euler(rotX, rotY, rotZ)); go.GetComponent <MagicBehaviour>().isHit = true; Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)); }
void DestroyObject() { NetPoolManager.Destroy(gameObject); }