public void OnSelectAoePoint(object sender, MyEventArgs args) { try { castSkillIndex = (int)args.args[0]; GameObject o = (GameObject)Instantiate(Resources.Load("aoeSphere")); aoePoint = o.GetComponent <GrabTargets>(); } catch (Exception e) { Debug.LogError(e.ToString()); } }
void Update() { Hotkeys(); if (Input.GetMouseButtonDown(0)) { if (!UIManager.instance.InDeadZone(Input.mousePosition)) { RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1000f)) { if (aoePoint != null) { string[] targets = aoePoint.GetTargets("Enemy"); view.SendReliable("CastInput", RpcTarget.Server, castSkillIndex, targets); Destroy(aoePoint.gameObject); aoePoint = null; castSkillIndex = -1; } else if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Terrain")) { Move(hit.point); } else if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Selectable")) { Select(hit.collider.gameObject); } } } } if (aoePoint != null) { RaycastHit aoeHit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out aoeHit, 1000f)) { aoePoint.transform.position = aoeHit.point; } } }