Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     if (identity == null)
     {
         identity = GetComponent <UnitIdentity>();
     }
     if (engine == null)
     {
         engine = GetComponent <ShipEngine>();
     }
     if (weaponHolder == null)
     {
         weaponHolder = GetComponent <ShipboardWeaponHolder>();
     }
     if (health == null)
     {
         health = GetComponent <Health>();
     }
     if (sheild == null)
     {
         sheild = GetComponent <Sheild>();
     }
     if (master != null)
     {
         master.Register(this);
     }
 }
Ejemplo n.º 2
0
 public void Initialize(ShipboardWeaponHolder target)
 {
     this.targetWeaponHolder = target;
     this.index = 0;
     if (!weaponSlotValid)
     {
         hidden = true;
     }
     else
     {
         hidden = false;
         int slotChangingButtonsCount = slotChangingButtons.Length;
         int targetWeaponSlotsCount   = target.weaponSlots.Count;
         if (targetWeaponSlotsCount < 2)
         {
             for (int i = 0; i < slotChangingButtonsCount; i++)
             {
                 var curButton = slotChangingButtons[i];
                 curButton.gameObject.SetActive(false);
             }
         }
         else
         {
             for (int i = 0; i < slotChangingButtonsCount; i++)
             {
                 var curButton = slotChangingButtons[i];
                 curButton.gameObject.SetActive(i < targetWeaponSlotsCount);
             }
         }
         SetIndex(0);
         RenewValues();
     }
 }
 public void SetTarget(Unit target)
 {
     if (target == null)
     {
         Clear();
         return;
     }
     this.target               = target.engine;
     this.weaponHolder         = target.weaponHolder;
     this.visualizeWeaponIndex = 0;
 }
 public void Clear()
 {
     target       = null;
     weaponHolder = null;
     for (int i = 0; i < movementBeaconParent.childCount; i++)
     {
         movementBeaconParent.GetChild(i).gameObject.SetActive(false);
     }
     if (fireBeacon != null)
     {
         fireBeacon.SetActive(false);
     }
     if (ceaseBeacon != null)
     {
         ceaseBeacon.SetActive(false);
     }
 }