Ejemplo n.º 1
0
        public IEnumerator TakeImage()
        {
            bool loop = true;

            while (loop)
            {
                Screenshot.TakeScreenShot(Args);
                ShootsTaken++;
                Args.LoopCount++;
                yield return(WaitForTimes.GetWaitForTime(WaitTime));

                if (Times != 0)
                {
                    if (Times == 1)
                    {
                        yield return(WaitForTimes.GetWaitForTime(WaitTime));

                        Screenshot.TakeScreenShot(Args);
                        loop = false;
                        Object.Destroy(obj);
                        yield break;
                    }
                    Times--;
                }
            }
        }
Ejemplo n.º 2
0
    private IEnumerator InputDelayJump()
    {
        userCoolingDownJump = true;

        yield return(WaitForTimes.GetWaitForTime(inputCooldown));

        userCoolingDownJump = false;
    }
Ejemplo n.º 3
0
        private IEnumerator Kill()
        {
            yield return(WaitForTimes.GetWaitForTime(lifeTime));

            Destroy(gameObject);             //Destroy object
        }
Ejemplo n.º 4
0
        private IEnumerator Disable()
        {
            yield return(WaitForTimes.GetWaitForTime(lifeTime));

            gameObject.SetActive(false);
        }
Ejemplo n.º 5
0
    private IEnumerator GameEnd()
    {
        yield return(WaitForTimes.GetWaitForTime(3));

        Restart();
    }
Ejemplo n.º 6
0
        private IEnumerator LevelLoad()
        {
            yield return(WaitForTimes.GetWaitForTime(timeLoad));

            SceneManager.LoadScene(levelNum);
        }
Ejemplo n.º 7
0
    private IEnumerator AiUnique(PlayerMotor callingObject)
    {
        var ball = FindObjectOfType <Ball>();
        // ReSharper disable once RedundantAssignment
        //Resharper seams to think this value is never used
        var finalRotation = Vector3.zero;
        var team          = TeamManager.Instance.GetTeam(callingObject.myTeam);
        var goal          = team.GetTeamsGoal();

        yield return(WaitForTimes.GetWaitForTime(GetReactionTime()));

        while (true)
        {
            var ballDist              = Vector3.Distance(ball.Position, callingObject.Position);
            var BallToGoalDirection   = GetDirection(goal.Position, ball.Position);
            var PlayerToGoalDirection = GetDirection(goal.Position, callingObject.Position);
            var PlayerToBallDirection = GetDirection(ball.Position, callingObject.Position);

            //Debug.Log(PlayerToGoalDirection);

            switch (AiMoterMode)
            {
            case InputMoterMode.BallOnly:
                //
                //Aim for the ball no matter what
                //
                finalRotation = AimForObject(ball.Position, callingObject);

                break;

            case InputMoterMode.Defensive:
                //
                //Make the Ai aim to keep the ball away from the goal while staying close to there goal
                //
                //TODO:Impliment Defensive AI
                finalRotation = AimForObject(ball.Position, callingObject);

                break;

            case InputMoterMode.GoalShooter:
                //
                //Make the Ai aim to get behind the ball then shoot for the goal
                //
                finalRotation = AimForObject(ball.Position - BallToGoalDirection, callingObject);

                //myRot = AimForObject((ball.Position + (-BallToGoalDirection * 2))+Vector3.up * 2, callingObject);
                break;

            case InputMoterMode.BallFollower:
                //
                //Make the Ai aim to get behind the ball then shoot for the goal
                //
                finalRotation = AimForObject(ball.Position + ((-BallToGoalDirection + (PlayerToBallDirection + PlayerToGoalDirection).normalized).normalized * 5), callingObject);

                break;

            case InputMoterMode.Aggressive:
                //
                //Aim for the closest none team mate
                //
                var otherMotor = PlayerMotor.GetClosestMotor(callingObject.Position, callingObject, callingObject.myTeam);
                var motorDist  = Vector3.Distance(otherMotor.Position, callingObject.Position);
                finalRotation = AimForObject(ballDist < motorDist? ball.Position : otherMotor.Position, callingObject);

                break;

            default:
                //
                //Default to just hitting the ball
                //
                finalRotation = AimForObject(ball.Position, callingObject);

                break;
            }

            finalRotation.x /= 4;
            finalRotation.z /= 4;
            //var rot = callingObject.transform.TransformDirection(Quaternion.Euler(myRot) * callingObject.transform.forward * GetMoveStrength());
            callingObject.HitPuck(finalRotation * GetMoveStrength());

            yield return(WaitForTimes.GetWaitForTime(GetReactionTime()));
        }
    }