private void Move(Vector3 destination) { if (gameObject.transform.position.x > destination.x) { Log("Moving Left"); _player.AIMove(gameObject, -0.5f * _player.DirectionModifier, 0); } else { Log("Moving Right"); _player.AIMove(gameObject, 0.5f * _player.DirectionModifier, 0); } }
// Update is called once per frame void FixedUpdate() { if (!initialized) { Reset(); } if (gameOver) { gameOverTimer -= Time.deltaTime; if (gameOverTimer <= 0) { Reset(); } return; } else { checkWinCondition(); } if (waitForAction && currentPlayer == opponent) { currentPlayer.AIMove(); } if (actionStack.Count > 0) { if (actionStack.Peek().Execute(this)) { actionStack.Pop(); } } else { StartTurn(); } }