示例#1
0
 void animRun()
 {
     if (agent.velocity.magnitude > 5.5)
     {
     }
     else
     {
         animState = TakaAnim.Walk;
     }
 }
示例#2
0
 void animIdle()
 {
     if (agent.velocity.magnitude < 0.5)
     {
     }
     else
     {
         animState = TakaAnim.Walk;
     }
 }
示例#3
0
 void animWalk()
 {
     if (agent.velocity.magnitude > 0.5)
     {
     }
     else
     {
         animState = TakaAnim.Idle;
     }
 }
示例#4
0
    void Start()
    {
        //intialize variables
        rb               = GetComponent <Rigidbody>();
        home             = gameObject.transform.position;
        distanceToFloor  = home.y + 0.1F;
        startingRotation = gameObject.transform.rotation;
        actorID          = GetComponent <Actor>();
        State            = TakaState.Idle;
        animState        = TakaAnim.Idle;
        awake            = false;
        PlayerObject     = GameObject.FindGameObjectWithTag("Player");
        cam              = Camera.main;
        oldPosition      = home;
        posTimer         = 6;
        posTimer2        = 3;
        root             = MazeGenerator.getSectionBasedOnLocation(home);
        if (root != null)
        {
            nodes = MazeGenerator.GetIntersectionNodes(root);
        }
        currentNode          = StartingNode;
        agent                = GetComponent <NavMeshAgent>();
        agent.updatePosition = false;
        agent.updateRotation = true;
        agent.nextPosition   = transform.position;
        //transform.position = agent.nextPosition;
        agent.Warp(transform.position);
        fleeingInu = false;

        column = (int)((home.x - 8) / 6);
        row    = (int)((home.z - 8) / 6);

        allNodes = MazeGenerator.nodesInSection(root);

        foreach (MazeNode n in allNodes)
        {
            if (n.Col == column && n.Row == row)
            {
                homeNode = n;
            }
        }
    }