コード例 #1
0
ファイル: WanderState.cs プロジェクト: DeadPoolP/SeriousGame
 public void ActiveWander()
 {
     fm.GetComponent <NavMeshAgent>().destination = fm.wanderpoints[nextWanderPoint].position;
     fm.GetComponent <NavMeshAgent>().Resume();
     if (Vector3.Distance(fm.wanderpoints[nextWanderPoint].position, fm.transform.position) < 1)
     {
         waitTime   = Random.Range(1, 5);
         arrived    = true;
         fm.curTime = fm.time;
     }
 }
コード例 #2
0
ファイル: OutState.cs プロジェクト: DeadPoolP/SeriousGame
    //State - Functions

    public void GoOut()
    {
        if (Vector3.Distance(fm.outside.position, fm.transform.position) < 1)
        {
            fm.GetComponent <NavMeshAgent>().Stop();
            fm.curTime = fm.time;
            arrived    = true;
        }
        else
        {
            fm.GetComponent <NavMeshAgent>().destination = fm.outside.position;
            fm.GetComponent <NavMeshAgent>().Resume();
        }
    }
コード例 #3
0
ファイル: UseState.cs プロジェクト: DeadPoolP/SeriousGame
    //State - Functions

    public void GoUse()
    {
        if (Vector3.Distance(fm.activityToMake.device.transform.position, fm.transform.position) < 2)
        {
            fm.GetComponent <NavMeshAgent>().Stop();
            fm.curTime = fm.time;
            fm.activityToMake.device.on = true;
            arrived = true;
        }
        else
        {
            fm.GetComponent <NavMeshAgent>().destination = fm.activityToMake.device.transform.position;
            fm.GetComponent <NavMeshAgent>().Resume();
        }
    }