Exemplo n.º 1
0
        private Vector3 GenerateValidDashDirection()
        {
            float   predictedDashDistance = AIUtil.GetRandomPredictedDashDistance();
            Vector3 playerPosition        = StateMachine_.Player.transform.position;

            Vector3 lastDashDirection = Vector3.zero;

            for (int i = 0; i < GameConstants.Instance.AIPositionRetries; i++)
            {
                Vector3 dashDirection   = UnityEngine.Random.insideUnitCircle.normalized;
                Vector3 dashEndPosition = playerPosition + (dashDirection * predictedDashDistance);

                lastDashDirection = dashDirection;

                if (!AIUtil.IsXZPositionOnPlatform(dashEndPosition) || AIUtil.DoesWallExistBetweenXZPoints(playerPosition, dashEndPosition))
                {
                    continue;
                }

                return(dashDirection);
            }

            Debug.LogWarning("Using invalid dash direction!", context: StateMachine_.Player);
            return(lastDashDirection);
        }
Exemplo n.º 2
0
        protected override void OnStateEntered()
        {
            predictedDashDistance_ = AIUtil.GetRandomPredictedDashDistance();

            target_ = BattlePlayerUtil.GetClosestEnemyPlayerFor(StateMachine_.Player);
        }