예제 #1
0
        void Start()
        {
            if (moveTowards.willMoveTowardsX || moveTowards.willMoveTowardsY)
            {
                if (moveTowards.isEnabled)
                {
                    moveTowards.transformToMoveTowards = GameManager.Instance.player.transform;
                }
            }

            if (startingMovement.willFacePlayerAtStart)
            {
                FacePlayer();
                if (GameManager.Instance.player)                //If we turn to face something, make sure our startingDirection is set to the direction we face
                {
                    if (startingMovement.horizontal != Direction.Horizontal.Neutral)
                    {
                        if (GameManager.Instance.player.transform.position.x < transform.position.x)
                        {
                            startingMovement.horizontal = Direction.Horizontal.Left;
                        }
                        else
                        {
                            startingMovement.horizontal = Direction.Horizontal.Right;
                        }
                    }

                    if (startingMovement.vertical != Direction.Vertical.Neutral)
                    {
                        if (GameManager.Instance.player.transform.position.y < transform.position.y)
                        {
                            startingMovement.vertical = Direction.Vertical.Down;
                        }
                        else
                        {
                            startingMovement.vertical = Direction.Vertical.Up;
                        }
                    }

                    if (moveTowards.usePlayerAsTarget)
                    {
                        moveTowards.transformToMoveTowards = GameManager.Instance.player.transform;
                    }
                }
            }

            if (slots.controller)
            {
                slots.controller.SetAxis(new Vector2((int)startingMovement.horizontal, (int)startingMovement.vertical));
            }

            attacks.currentFrameBetweenAttacks = RexMath.RandomInt(attacks.minFramesBetweenAttacks, attacks.maxFramesBetweenAttacks);
            jump.currentFrameBetweenJumps      = jump.framesBetweenJumps;
        }
예제 #2
0
 protected void CheckForAttacks()
 {
     if (attacks.attackToPerform != null)
     {
         attacks.currentFrameBetweenAttacks--;
         if (attacks.currentFrameBetweenAttacks <= 0)
         {
             attacks.currentFrameBetweenAttacks = RexMath.RandomInt(attacks.minFramesBetweenAttacks, attacks.maxFramesBetweenAttacks);
             attacks.attackToPerform.Begin();
         }
     }
 }
예제 #3
0
    public void Show()
    {
        string message = "READY";

        if (messages.Count > 0)
        {
            int random = RexMath.RandomInt(0, messages.Count - 1);
            message = messages[random];
        }

        textMesh.text = message;

        StartCoroutine("ShowCoroutine");
    }