Ejemplo n.º 1
0
    }    //Start

    Vector2 GetTargetPos()
    {
        if (isScattering)
        {
            return(scatterPoint);
        }        //

        //TODO, chase mode VS scatter mode
        Vector2 thePos = Vector2.zero;

        if (type == GhostType.Chaser)
        {
            thePos = (Vector2)pacman.transform.position;
        }        //if
        else if (type == GhostType.Ambusher)
        {
            thePos = pacman.GetAmbushPos(4);
        }        //else if
        else if (type == GhostType.Whimsical)
        {
            Vector2 redToPacAmbush = (pacman.GetAmbushPos(2) - chaseGhost.dest) * 2;
            thePos = chaseGhost.dest + redToPacAmbush;
        }        //else if
        else if (type == GhostType.Tricky)
        {
            if (Vector2.Distance(dest, pacman.dest) >= 8)
            {
                thePos = (Vector2)pacman.transform.position;
            }
            else
            {
                thePos = new Vector2(0, -2);
            }
        }        //else if

        return(thePos);
    }    //GetTargetPos