Inheritance: EnemyBehavior
    void Start()
    {
        AStarScript = AStarRef.GetComponent <Pathfinding>();
        animator    = GetComponent <Animator>();

        //closestNode = FindClosestNode(transform.position);
        //currentCluster = closestNode.GetComponent<Node>().cluster;

        if (NPCType + "" == "Chaser")
        {
            CBehavior = GetComponent <ChaserBehavior>();
        }
        else if (NPCType + "" == "Runner")
        {
            RBehavior = GetComponent <RunnerBehavior>();
        }
    }
Ejemplo n.º 2
0
    /*  --NeutralX, NeutralY--
     *  Given a runner ID, returns the coordinates of the point
     *  the runner should generally occupy. Calculates these
     *  coordinates based on the runner's current track, and,
     *  if applicable, other runners on that track. */
    public float NeutralX(int who)
    {
        who = ConstrainID(who);
        RunnerBehavior rb = runnerBehaviors[who];

        if (rb == null || !rb.Alive())
        {
            return(-PlayAreaWidth());
        }
        else if (rb.Dashing())
        {
            return(dashPosition);
        }
        else
        {
            return(neutralPosition);
        }
    }
Ejemplo n.º 3
0
    public float NeutralY(int who)
    {
        who = ConstrainID(who);
        RunnerBehavior rb = runnerBehaviors[who];

        if (rb == null || !rb.Alive())
        {
            GameObject go = runners[who];
            if (go == null)
            {
                return(0);
            }
            else
            {
                return(go.transform.position.y);
            }
        }
        else
        {
            int        track     = ConstrainID(rb.DestTrack());
            List <int> neighbors = OnTrack(track);
            int        ordinal   = -1;
            for (int i = 0; i < neighbors.Count; ++i)
            {
                if (neighbors[i] == who)
                {
                    ordinal = i;
                    break;
                }
            }
            if (ordinal < 0)
            {
                return(TrackCenter(track));
            }
            else
            {
                return(TrackTop(track) -
                       (ordinal + 1) * TrackHeight()
                       / (neighbors.Count + 1));
            }
        }
    }
 public void Start()
 {
     rb = gameObject.GetComponent <RunnerBehavior>();
 }