Exemplo n.º 1
0
        public override void Chase()
        {
            if (PacmanGameObject == null)
            {
                return;
            }

            switch (PacmanGameObject.GetComponent <Pacman>().Direction)
            {
            case Pacman.Directions.Up:
                MoveToTarget(PacmanGameObject.transform.position + new Vector3(0, 3, 0));
                break;

            case Pacman.Directions.Right:
                MoveToTarget(PacmanGameObject.transform.position + new Vector3(3, 0, 0));
                break;

            case Pacman.Directions.Down:
                MoveToTarget(PacmanGameObject.transform.position + new Vector3(0, -3, 0));
                break;

            case Pacman.Directions.Left:
                MoveToTarget(PacmanGameObject.transform.position + new Vector3(-3, 0, 0));
                break;
            }
        }
Exemplo n.º 2
0
        public override void Chase()
        {
            if (PacmanGameObject == null)
            {
                return;
            }

            Vector3 intermediatePoint;

            switch (PacmanGameObject.GetComponent <Pacman>().Direction)
            {
            case Pacman.Directions.Up:
                intermediatePoint = PacmanGameObject.transform.position + new Vector3(0, 2, 0);
                break;

            case Pacman.Directions.Right:
                intermediatePoint = PacmanGameObject.transform.position + new Vector3(2, 0, 0);
                break;

            case Pacman.Directions.Down:
                intermediatePoint = PacmanGameObject.transform.position + new Vector3(0, -2, 0);
                break;

            case Pacman.Directions.Left:
                intermediatePoint = PacmanGameObject.transform.position + new Vector3(-2, 0, 0);
                break;

            default:
                intermediatePoint = PacmanGameObject.transform.position;
                break;
            }

            Vector3 intermediateVector = intermediatePoint - _blinky.transform.position;

            MoveToTarget(2 * new Vector3((float)Math.Round(intermediateVector.x),
                                         (float)Math.Round(intermediateVector.y),
                                         (float)Math.Round(intermediateVector.z)));
        }