Example #1
0
        void Awake()
        {
            //weapon loadout
            _weapons = Resources.FindObjectsOfTypeAll <UnitWeapon>();
            if (_weapons == null || _weapons.Length < 1)
            {
                Debug.LogWarning("WeaponMgr found no weapons!");
            }

            _defaultMelee  = DefaultMelee;
            _defaultRanged = DefaultRanged;

            //ammo depot pools
            Arrows        = ArrowDepot;
            MagicMissiles = MagicMissileDepot;
            Lightning     = LightningDepot;

            /*
             * AmmoDepot[] depots = GetComponents<AmmoDepot>();
             * foreach (var d in depots)
             * {
             *  switch (d.WhatAmmoType)
             *  {
             *      case "magicMissiles":
             *          MagicMissiles = d;
             *          continue;
             *      default:
             *      case "arrows":
             *          Arrows = d;
             *          continue;
             *  }
             * }*/
        }
Example #2
0
        void Awake()
        {
            //cache handle to weapon child; hide for now
            CurrentWeapon = GetComponentInChildren <UnitWeapon>(true);
            if (CurrentWeapon == null)
            {
                Debug.LogWarning("Unit " + gameObject.name + " - " + Name + " weapon child not found!");
            }

            //cache
            _head         = GetComponentInChildren <UnitHead>()?.gameObject;
            _healthBar    = GetComponentInChildren <HealthBar>();
            SelectionRing = GetComponentInChildren <SelectionRing>();
        }