void Awake() { gameObject.GetComponent <Collider>().isTrigger = true; gameObject.layer = TDS.GetLayerCollectible(); if (type == _CollectType.Self) { //initiate the weapon list to contain all weapon if the condition is checked if (gainWeapon && randomWeapon && enableAllWeapon) { weaponList = new List <Weapon>(WeaponDB.Load()); } //make sure none of the element in weaponList is null for (int i = 0; i < weaponList.Count; i++) { if (weaponList[i] == null) { weaponList.RemoveAt(i); i -= 1; } } } //effect=EffectDB.CloneItem(effectID); effectIdx = EffectDB.GetEffectIndex(effectID); if (triggerEffectObj != null) { ObjectPoolManager.New(triggerEffectObj, 1); } }
// Use this for initialization public override void Awake() { base.Awake(); thisObj.layer = TDS.GetLayerPlayer(); isPlayer = true; SetDestroyCallback(this.PlayerDestroyCallback); if (enableAllWeapons) { weaponList = new List <Weapon>(WeaponDB.Load()); } if (weaponMountPoint == null) { weaponMountPoint = thisT; } if (turretObj != null) { turretObjParent = turretObj.parent; } else { turretObj = thisT; faceTravelDirection = false; } hitPointBase = hitPointFull; energyBase = energyFull; progress = thisObj.GetComponent <PlayerProgression>(); if (progress != null) { progress.SetPlayer(this); } perk = thisObj.GetComponent <PlayerPerk>(); if (perk != null) { perk.SetPlayer(this); } Load(); }