void LateUpdate() { mosepose = Input.mousePosition; if (MoveControl && !CorrectUnit.Enemy && !CorrectUnit._effectOnUnit.HaveEffect(2) && !EventSystem.current.IsPointerOverGameObject()) { if (Input.GetKeyDown(KeyCode.Mouse0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 5000, Mask)) { Vector3 PoitionToChek; PoitionToChek = hit.point; var node = GridABSManager.NodeFromWorldPoint(PoitionToChek); if (GridABSManager.WalkableArea.Contains(node) && node != GridABSManager.NodeFromWorldPoint(CorrectUnit.transform.position)) { GridABSManager.ClearNode(CorrectUnit.transform.position); StartCoroutine(CorrectUnit.LerpMove(node.Position + Vector3.forward * 0.12f + Vector3.up * 0.34f)); CorrectUnit.transform.eulerAngles = new Vector3(20, -45, 0); GridABSManager.ClearNode(node.Position + Vector3.forward * 0.12f + Vector3.up * 0.34f, CorrectUnit); GridABSManager.CleatGrid(); } } } } if (!CorrectUnit.Enemy) { NeedMoveVectorCam = Vector3.zero; if (Input.GetKeyDown(KeyCode.Alpha1)) { ChengBoolMoveControl(); } if (Input.GetKeyDown(KeyCode.Alpha2)) { ChengBoolAttackControl(); } if (Input.GetKeyDown(KeyCode.Alpha3)) { ChengBoolPercUseControl(); } if (Input.GetKeyDown(KeyCode.R)) { ReloadUnitWeapon(); } } }
void MakeBoom() { for (int i = 0; i < vectorsOfGrande.Length; i++) { Vector2 n = vectorsOfGrande[i]; UnitBehevior unitTarget = GridManager.NodeFromWorldPoint(new Vector3(n.x, 0, n.y)).UnitOnNode; if (unitTarget != null) { switch (CAParm) { case 0: unitTarget.GetHit(PowerPerc, 434); break; case 1: Vector3 poitionToChek = unitTarget.transform.position + (unitTarget.transform.position - point).normalized * PowerPerc; //Check if (GridManager.NodeFromWorldPoint(poitionToChek)._Bloc == NodeA.TypeOfNode.Walkable && GridManager.NodeFromWorldPoint(poitionToChek).UnitOnNode == null) { GridManager.ClearNode(unitTarget.transform.position); StartCoroutine(unitTarget.LerpMove(GridManager.NodeFromWorldPoint(poitionToChek).Position + Vector3.forward * 0.12f + Vector3.up * 0.34f)); unitTarget.transform.eulerAngles = new Vector3(20, -45, 0); GridManager.ClearNode( GridManager.NodeFromWorldPoint(poitionToChek).Position + Vector3.forward * 0.12f + Vector3.up * 0.34f, unitTarget); unitTarget.GetHit(PowerPerc * 4, 434); } else { unitTarget.GetHit(PowerPerc * 12, 434); } break; case 2: unitTarget._effectOnUnit.MakeStuned(1); break; case 3: unitTarget._effectOnUnit.MakeFired(PowerPerc, 2); break; case 4: unitTarget._effectOnUnit.MakeElectricShock(PowerPerc); break; } } foreach (Shelter sh in GridManager.CurrentShelterList) { if (Vector3.Distance(sh.transform.position, new Vector3(n.x, 0, n.y)) < 1) { Instantiate(sh.FX, sh.transform.position, Quaternion.identity); sh.ShelterLevl -= PowerPerc * 3; if (sh.ShelterLevl < 1) { Destroy(sh.gameObject); } } } } Instantiate(manager.OnTurnEffectFX[CAParm + 2], point + Vector3.up * 0.75f, Quaternion.identity); manager.PlaySpecific(manager.Expl); }