예제 #1
0
 private void Start()
 {
     BehaviourScript = gameObject.GetComponent <RobotBehaviourScript>();
     if (BehaviourScript == null)
     {
         throw new NullReferenceException("Could not find a RobotBehaviourScript on " + gameObject.name);
     }
 }
예제 #2
0
 /// <summary>
 /// Helper method to get the index of the for loop start
 /// </summary>
 private int GetIndexOfScript(RobotBehaviourScript script)
 {
     for (int i = 0; i < GetComponents <RobotBehaviourScript>().Length; i++)
     {
         if (GetComponents <RobotBehaviourScript>()[i] == script)
         {
             return(i);
         }
     }
     throw new KeyNotFoundException();
 }