示例#1
0
        public override void onAdd(GameBase obj)
        {
            ShapeBase sbobj = obj._ID;

            sbobj.setRechargeRate(this["rechargeRate"].AsFloat());
            sbobj.setEnergyLevel(this["MaxEnergy"].AsFloat());
            sbobj.setRepairRate(0);


            if (obj["mountable"] == "1" || obj["mountable"] == string.Empty)
            {
                this.isMountable((TurretShape)sbobj, true.AsString());
            }
            else
            {
                this.isMountable((TurretShape)sbobj, false.AsString());
            }

            if (this["nameTag"] != string.Empty)
            {
                sbobj.setShapeName(this["nameTag"]);
            }
            for (int i = 0; i < this["numWeaponMountPoints"].AsInt(); i++)
            {
                sbobj.incInventory(this["weapon[" + i + "]"], 1);
                ItemData weaponAmmo       = this["weaponAmmo[" + i + "]"];
                string   weaponAmmoAmount = this["weaponAmmoAmount[" + i + "]"];
                sbobj.incInventory(weaponAmmo, weaponAmmoAmount.AsInt());
                bool startLoaded = this["startLoaded"].AsBool();
                sbobj.mountImage(this["weapon[" + i + "].Image"], i, startLoaded, string.Empty);
                sbobj.setImageGenericTrigger(i, 0, false);
            }
            if (this["enterSequence"] != string.Empty)
            {
                obj["entranceThread"] = "0";
                int    et = obj["entranceThread"].AsInt();
                string es = this["enterSequence"];
                sbobj.playThread(et, es);
                sbobj.pauseThread(et);
            }
            else
            {
                obj["entranceThread"] = "-1";
            }
        }