Beispiel #1
0
        private void cache()
        {
            _cacheItem        = RightItem;
            _cachedComponent  = null;
            _cachedGun        = RightItem == null ? null : RightItem.GetComponent <BaseGun>();
            _cachedRightMelee = RightItem == null ? null : RightItem.GetComponent <BaseMelee>();
            _cachedLeftMelee  = LeftItem == null ? null : LeftItem.GetComponent <BaseMelee>();

            _cachedTool       = RightItem == null ? null : RightItem.GetComponent <Tool>();
            _cachedPhone      = RightItem == null ? null : RightItem.GetComponent <Phone>();
            _cachedRadio      = RightItem == null ? null : RightItem.GetComponent <Radio>();
            _cachedFlashlight = RightItem == null ? null : RightItem.GetComponent <Flashlight>();

            if (_cachedFlashlight == null && RightItem != null)
            {
                _cachedFlashlight = RightItem.GetComponentInChildren <Flashlight>();
            }

            if (_cachedPhone != null)
            {
                _cachedToolType = ToolType.phone;
            }
            else if (_cachedRadio != null)
            {
                _cachedToolType = ToolType.radio;
            }
            else if (_cachedFlashlight != null)
            {
                _cachedToolType = ToolType.flashlight;
            }
            else
            {
                _cachedToolType = ToolType.none;
            }
        }
Beispiel #2
0
 private void Awake()
 {
     _melee = GetComponent <BaseMelee>();
 }