コード例 #1
0
        public void TurretShapeData_OnAdd(coTurretShapeData thisobj, coShapeBase obj)
        {
            obj.setRechargeRate(thisobj["rechargeRate"].AsFloat());
            obj.setEnergyLevel(thisobj["MaxEnergy"].AsFloat());
            obj.setRepairRate(0);


            if (obj["mountable"] == "1" || obj["mountable"] == "")
            {
                thisobj.call("isMountable", obj, true.AsString());
            }
            else
            {
                thisobj.call("isMountable", obj, false.AsString());
            }

            if (thisobj["nameTag"] != "")
            {
                obj.setShapeName(thisobj["nameTag"]);
            }
            for (int i = 0; i < thisobj["numWeaponMountPoints"].AsInt(); i++)
            {
                ShapeBaseShapeBaseIncInventory(obj, thisobj["weapon[" + i + "]"], 1);

                coItemData weaponAmmo = thisobj["weaponAmmo[" + i + "]"];


                string weaponAmmoAmount = thisobj["weaponAmmoAmount[" + i + "]"];
                ShapeBaseShapeBaseIncInventory(obj, weaponAmmo, weaponAmmoAmount.AsInt());


                bool startLoaded = thisobj["startLoaded"].AsBool();

                obj.mountImage(thisobj["weapon[" + i + "].Image"], i, startLoaded, "");
                obj.setImageGenericTrigger(i, 0, false);
            }
            if (thisobj["enterSequence"] != "")
            {
                obj["entranceThread"] = "0";
                int    et = obj["entranceThread"].AsInt();
                string es = thisobj["enterSequence"];
                obj.playThread(et, es);
                obj.pauseThread(et);
            }
            else
            {
                obj["entranceThread"] = "-1";
            }
        }