コード例 #1
0
 void Update()
 {
     // If we don't currently have a target pickup then target the nearest one. If we do
     // have a target and we are within detection range then pick it up.
     if (target == null)
     {
         target = PickupSensor.GetNearestByComponent <Holdable>();
         if (target != null)
         {
             Steering.IgnoreList.Clear();
             Steering.IgnoreList.Add(target.gameObject);
             Steering.DestinationTransform = target.transform;
         }
     }
     else if (InteractionRange.IsDetected(target.gameObject))
     {
         // Pickup the target.. (Destroy it to show it has been picked up)
         Destroy(target.gameObject);
         target = null;
     }
 }
コード例 #2
0
ファイル: CharacterControls.cs プロジェクト: Sfalvo1/RTS_Test
 void Start()
 {
     rb            = GetComponent <Rigidbody>();
     isInteracting = false;
     held          = null;
 }