Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        mySeek           = new Seek();
        mySeek.character = this;
        mySeek.target    = target;
        myFlee           = new Flee();
        myFlee.character = this;
        myFlee.target    = target;

        myArrv           = new Arrive();
        myArrv.character = this;
        myArrv.target    = target;

        myAlgn           = new Align();
        myAlgn.character = this;
        myAlgn.target    = target;

        myFace           = new Face();
        myFace.character = this;
        myFace.target    = target;

        myLWYG           = new LookWhereGoing();
        myLWYG.character = this;
        myLWYG.target    = target;

        myFPth           = new FollowPathDemo();
        myFPth.character = this;
        myFPth.path      = waypointList;
        //myFPth.target = target;
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        myRotateType           = new LookWhereGoing();
        myRotateType.character = this;
        myRotateType.target    = target;

        Graph myGraph = new Graph();

        myGraph.Build();
        List <Connection> path = Dijkstra.pathfind(myGraph, start, goal);

        // path is a list of connections - convert this to gameobjects for the FollowPath steering behavior

        myPath = new GameObject[path.Count + 1];
        int i = 0;

        foreach (Connection c in path)
        {
            Debug.Log("from " + c.getFromNode() + " to " + c.getToNode() + " @" + c.getCost());
            myPath[i] = c.getFromNode().gameObject;
            i++;
        }
        myPath[i] = goal.gameObject;

        myMoveType           = new FollowPathDemo();
        myMoveType.character = this;
        myMoveType.path      = myPath;
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    protected virtual void Start()
    {
        mySeek           = new Seek();
        mySeek.character = this;
        mySeek.target    = target;
        myFlee           = new Flee();
        myFlee.character = this;
        myFlee.target    = target;

        myArrv           = new Arrive();
        myArrv.character = this;
        myArrv.target    = target;

        myAlgn           = new Align();
        myAlgn.character = this;
        myAlgn.target    = target;

        myFace           = new Face();
        myFace.character = this;
        myFace.target    = target;

        myLWYG           = new LookWhereGoing();
        myLWYG.character = this;
        myLWYG.target    = target;

        myFPth           = new FollowPathDemo();
        myFPth.character = this;
        myFPth.path      = waypointList;

        mySepr           = new Separation();
        mySepr.character = this;

        myPrsu           = new Pursue();
        myPrsu.character = this;
        myPrsu.target    = target;

        myClAv           = new CollAvoid();
        myClAv.character = this;
        myClAv.targets   = collAvoidTargets;

        myObAv           = new ObstAvoid();
        myObAv.character = this;

        controlledSteeringUpdate = new SteeringOutput();
    }