コード例 #1
0
    /**
    * Randonly pick the next waypoint for the NPC
    */
    private void chooseNextRoute(NpcMovement npcMov)
    {
        //throw new NotImplementedException();

        int randomInt = UnityEngine.Random.Range(0, 2);

        if (randomInt < 1)
        {
            Debug.Log("A route chosen");
            npcMov.SetNextWaypoint(branchWaypoints_A[0]);
        }
        else {
            Debug.Log("B route chosen");
            npcMov.SetNextWaypoint(branchWaypoints_B[0]);
        }
    }
コード例 #2
0
ファイル: NPCSpawner.cs プロジェクト: SabiKov/HumanEvolution2
 /**
  * Get movement script reference from newly created npc game object
  * Get next waypoint location and set this value on npc movement script
  */
 void releaseNpc( GameObject newNpc )
 {
     GameObject firstWPoint = getFirstWaypoint();
     npcMovement = newNpc.GetComponent<NpcMovement>();
     npcMovement.SetNextWaypoint(firstWPoint);
 }