コード例 #1
0
ファイル: Collectible.cs プロジェクト: crafics/globetrotter2
        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>(Weapon_DB.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 = Effect_DB.GetEffectIndex(effectID);

            if (triggerEffectObj != null)
            {
                ObjectPoolManager.New(triggerEffectObj, 1);
            }
        }
コード例 #2
0
        // 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>(Weapon_DB.Load());
            }

            if (weaponMountPoint == null)
            {
                weaponMountPoint = thisT;
            }

            if (enableTurretRotate)
            {
                if (turretObj != null)
                {
                    turretObjParent = turretObj.parent;
                }
                else
                {
                    turretObj = thisT;
                    //faceTravelDirection=false;
                }
            }

            hitPointBase = hitPointFull;
            energyBase   = energyFull;

            InitSpawnImmunity();

            progress = thisObj.GetComponent <PlayerProgression>();
            if (progress != null)
            {
                progress.SetPlayer(this);
            }

            perk = thisObj.GetComponent <PlayerPerk>();
            if (perk != null)
            {
                perk.SetPlayer(this);
            }

            Load();
        }