private void ExecuteAttack() { mTurnStatus = EnemyTurnStatus.Running; Node targetNode = mPath.First.Next.Value; // Do not move the enemy in the grid for attack. ScaleToAction scaleUp = new ScaleToAction(this.transform, Graph.SmoothStep, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.75f, 0.5f); scaleUp.OnActionStart += () => { AudioManager.PlayPreAtkSound(); }; MoveToAction moveToPos = new MoveToAction(this.transform, Graph.Dipper, DungeonManager.Instance.GridPosToWorldPos(targetNode.PosX, targetNode.PosY), 0.25f); ScaleToAction scaleDownHit = new ScaleToAction(this.transform, Graph.Dipper, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.1f, 0.25f); ActionParallel hitParallel = new ActionParallel(moveToPos, scaleDownHit); hitParallel.OnActionFinish += () => { GameManager.Instance.Player.TakeDamage(typeAlgorithms[(int)UnitType].GetDamagePower()); }; DelayAction returnDelay = new DelayAction(0.1f); MoveToAction moveBack = new MoveToAction(this.transform, Graph.SmoothStep, DungeonManager.Instance.GridPosToWorldPos(PosX, PosY), 0.5f); ScaleToAction scaleDownReturn = new ScaleToAction(this.transform, Graph.SmoothStep, Vector3.one * DungeonManager.Instance.ScaleMultiplier, 0.5f); ActionParallel returnParallel = new ActionParallel(moveBack, scaleDownReturn); ActionSequence sequence = new ActionSequence(scaleUp, hitParallel, returnDelay, returnParallel); sequence.OnActionFinish = () => { mTurnStatus = EnemyTurnStatus.Processed; }; ActionHandler.RunAction(sequence); }
public void ExecuteTurn() { if (mTurnStatus == EnemyTurnStatus.Waiting) { ExecuteAttack(); return; } mTurnStatus = EnemyTurnStatus.Running; GeneratePath(); if (mPath == null) { Debug.LogWarning("Path returned Null"); mTurnStatus = EnemyTurnStatus.Processed; return; } Node targetNode = mPath.First.Next.Value; if (DungeonManager.Instance.IsPlayerPos(targetNode.PosX, targetNode.PosY)) { mTurnStatus = EnemyTurnStatus.Waiting; } else { ExecuteMove(); } }
private void ExecuteMove() { AudioManager.PlayMoveSound(); Node targetNode = mPath.First.Next.Value; MovePosition(targetNode.PosX, targetNode.PosY); MoveToAction moveToPos = new MoveToAction(this.transform, Graph.InverseExponential, DungeonManager.Instance.GridPosToWorldPos(targetNode.PosX, targetNode.PosY), 0.5f); moveToPos.OnActionFinish = () => { mTurnStatus = EnemyTurnStatus.Processed; }; ActionHandler.RunAction(moveToPos); BoardScroller.Instance.FocusCameraToPos( DungeonManager.Instance.GridPosToWorldPos(PosX, PosY), 0.2f, Graph.InverseExponential); }
public void ResetTurnStatus() { mTurnStatus = EnemyTurnStatus.Unprocessed; }