Example #1
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            currScatterTime = 0.0f;
            currPosIndex    = 0;
            ghost.MoveTo(ghost.CornerPositions[0].position);
        }
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            ghost.MoveTo(Player.instance.transform.position);
            currUpdateTime = 0.0f;
            currChaseTime  = 0.0f;
        }
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            ghost.isRetreating = true;
            ghost.MoveTo(MapInfo.CageExit);
            movingToCageExit = true;
            movingToCagePos  = false;

            ghost.SpriteAnimator.SetBool("is_retreating", true);
        }
Example #4
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            player      = !player ? Player.instance : player;
            tilemap     = !tilemap ? MapInfo.CollisionMap : tilemap;
            pathfinding = !pathfinding ? Pathfinding.instance : pathfinding;
            ghost       = !ghost?animator.GetComponent <GhostAI>() : ghost;

            ghost.MoveTo(player.transform.position);
            currUpdateTime = 0.0f;
            currChaseTime  = 0.0f;
        }
Example #5
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            ghost.isFrightened = true;
            currScaredTime     = 0.0f;
            currPosIndex       = 0;
            ghost.MoveTo(ghost.CornerPositions[0].position);
            ghost.CurrentSpeed = ghost.ScaredSpeed;
            ghost.SpriteAnimator.SetBool("is_frightened", true);
            ghost.SpriteAnimator.SetBool("is_flashing", true);
        }
Example #6
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            tilemap = !tilemap ? MapInfo.CollisionMap : tilemap;
            // The following line is weird, but is done because of lazyness to make it work
            // with the line in OnStateUpdate: "isMovingDown = !isMovingDown"
            isMovingDown = !ghost.StartMovingDownInCage;
            animator.SetBool("is_retreating", false);
            if (!ghost.StartInCage)
            {
                animator.SetBool("is_chasing", true);
                animator.SetBool("is_in_cage", false);
            }
            ghost.CurrentSpeed = ghost.ScaredSpeed;
        }
Example #7
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            ghost = !ghost?animator.GetComponent <GhostAI>() : ghost;

            ghost.MoveIgnoreCollision(new Vector3[] { MapInfo.CageCenter, MapInfo.CageExit });
        }