public void WheeledVehicleDataOnAdd(coWheeledVehicleData thisobj, coWheeledVehicle obj, int nameSpaceDepth)
            {
            int nsd = (nameSpaceDepth + 1);
            console.ParentExecute(thisobj, "onAdd", nsd, new string[] {thisobj, obj});
            // Setup the car with some tires & springs
            for (int i = obj.getWheelCount() - 1; i >= 0; i--)
                {
                obj.setWheelTire(i, "CheetahCarTire");
                obj.setWheelSpring(i, "CheetahCarSpring");
                obj.setWheelPowered(i, false);
                }
            // Steer with the front tires
            obj.setWheelSteering(0, 1);
            obj.setWheelSteering(1, 1);

            // Only power the two rear wheels... assuming there are only 4 wheels.
            obj.setWheelPowered(2, true);
            obj.setWheelPowered(3, true);
            }
 public void WheeledVehicleDataOnCollision(coWheeledVehicleData thisobj, coWheeledVehicle obj, string col, string vec, string speed)
     {
     // Collision with other objects, including items
     }
Example #3
0
        public void CheetahCarOnAdd(coWheeledVehicleData datablock, coWheeledVehicle vehicle, string nameSpaceDepth)
            {
            int nsd = (nameSpaceDepth.AsInt() + 1);
            console.ParentExecute(datablock, "onAdd", nsd, new string[] { datablock, vehicle.ID });
            vehicle.setWheelTire(0, "CheetahCarTire");
            vehicle.setWheelTire(1, "CheetahCarTire");
            vehicle.setWheelTire(2, "CheetahCarTireRear");
            vehicle.setWheelTire(3, "CheetahCarTireRear");


            // Setup the car with some tires & springs
            for (int i = vehicle.getWheelCount() - 1; i >= 0; i--)
                {
                vehicle.setWheelPowered(i, true);
                vehicle.setWheelSpring(i, "CheetahCarSpring");
                }
            // Steer with the front tires
            vehicle.setWheelSteering(0, 1);
            vehicle.setWheelSteering(1, 1);


            // Add tail lights
            Torque_Class_Helper tc = new Torque_Class_Helper("PointLight", "");
            tc.Props.Add("radius", "1");
            tc.Props.Add("isEnabled", "0");
            tc.Props.Add("color", @"""1 0 0.141176 1""");
            tc.Props.Add("brightness", "2");
            tc.Props.Add("castShadows", "1");
            tc.Props.Add("priority", "1");
            tc.Props.Add("animate", "0");
            tc.Props.Add("animationPeriod", "1");
            tc.Props.Add("animationPhase", "1");
            tc.Props.Add("flareScale", "1");
            tc.Props.Add("attenuationRatio", @"""0 1 1""");
            tc.Props.Add("shadowType", @"""DualParaboloidSinglePass""");
            tc.Props.Add("texSize", "512");
            tc.Props.Add("overDarkFactor", @"""2000 1000 500 100""");
            tc.Props.Add("shadowDistance", "400");
            tc.Props.Add("shadowSoftness", "0.15");
            tc.Props.Add("numSplits", "1");
            tc.Props.Add("logWeight", "0.91");
            tc.Props.Add("fadeStartDistance", "0");
            tc.Props.Add("lastSplitTerrainOnly", "0");
            tc.Props.Add("representedInLightmap", "0");
            tc.Props.Add("shadowDarkenColor", @"""0 0 0 -1""");
            tc.Props.Add("includeLightmappedGeometryInShadow", "0");
            tc.Props.Add("rotation", @"""1 0 0 0 """);
            tc.Props.Add("canSave", "1");
            tc.Props.Add("canSaveDynamicFields", "1");
            tc.Props.Add("splitFadeDistances", @"""10 20 30 40""");


            vehicle["rightBrakeLight"] = ((coPointLight)tc.Create());
            vehicle["leftBrakeLight"] = ((coPointLight)tc.Create());
            vehicle["inv[BulletAmmo]"] = "1000";

            // Mount a ShapeBaseImageData
            vehicle.mountImage("TurretImage", datablock["turretSlot"].AsInt(), true, "");

            // Mount the brake lights
            vehicle.mountObject(vehicle["rightBrakeLight"], datablock["rightBrakeSlot"].AsInt(), new TransformF(true));
            vehicle.mountObject(vehicle["leftbrakelight"], datablock["leftBrakeSlot"].AsInt(), new TransformF(true));
            }
Example #4
0
 public void CheetahCarOnMount(coWheeledVehicleData datablock, coWheeledVehicle vehicle, int slot)
     {
     // Load the gun
     vehicle.setImageAmmo(slot, true);
     }
Example #5
0
 public void CheetahCarOnTrigger(coWheeledVehicleData datablock, coWheeledVehicle vehicle, int index, bool state)
     {
     // Pass trigger states on to TurretImage (to fire weapon)
     switch (index)
         {
         case 0:
             vehicle.setImageTrigger(datablock["turretSlot"].AsInt(), state);
             break;
         case 1:
             vehicle.setImageAltTrigger(datablock["turretSlot"].AsInt(), state);
             break;
         }
     }
Example #6
0
 public void CheetahCarOnRemove(coWheeledVehicleData datablock, coWheeledVehicle vehicle, string nameSpaceDepth)
     {
     int nsd = (nameSpaceDepth.AsInt() + 1);
     console.ParentExecute(datablock, "onRemove", nsd, new[] { datablock.ID, vehicle.ID });
     if ((vehicle["rightBrakeLight"]).isObject())
         (vehicle["rightBrakeLight"]).delete();
     if ((vehicle["leftBrakeLight"]).isObject())
         (vehicle["leftBrakeLight"]).delete();
     if ((vehicle["turret"]).isObject())
         (vehicle["turret"]).delete();
     }