public virtual void damage(GameBase sourceobject, Point3F position, float damage, string damagetype) { if (!isObject()) return; ShapeBaseData datablock = getDataBlock(); datablock.damage(this, position, sourceobject, damage, damagetype); }
public override void onExplode(Projectile proj, Point3F pos, float fade) { // Damage objects within the projectiles damage radius float radius = this["damageRadius"].AsFloat(); if (radius <= 0) return; string damageType = this["damageType"]; float areaImpulse = this["areaImpulse"].AsFloat(); float radiusDamage = this["radiusDamage"].AsFloat(); CustomObjects.Utilities.radiusDamage.RadiusDamage(proj, pos, radius, radiusDamage, damageType, areaImpulse); }
public override void onCollision(Projectile proj, SceneObject col, float fade, Point3F pos, Point3F normal) { // Apply damage to the object all shape base objects if (this["directDamage"].AsFloat() > 0) { if ((console.getTypeMask(col) & (uint) SceneObjectTypesAsUint.ShapeBaseObjectType) == (uint) SceneObjectTypesAsUint.ShapeBaseObjectType) { ShapeBase shapebase = col._ID; shapebase.damage(proj, pos, this["directDamage"].AsFloat(), this["damageType"]); } } }
public override void onCollision(ShapeBase obj, SceneObject collObj, Point3F vec, float len) { if (!((collObj.GetType() == typeof (Player)) || (collObj.GetType() == typeof (AIPlayer)))) return; Player player = (Player) collObj; if (player.getDamageLevel() <= 0.00 || player.getState() == "Dead") return; player.applyRepair(this["repairAmount"].AsFloat()); player.setEnergyLevel(1); obj.schedule((100).AsString(), "startFade", "1000", "0", "true"); obj.schedule((1200).AsString(), "delete"); Audio.AudioServerPlay3D("HealthUseSound", player.getTransform()); }
public SpotLight(Color diffuseColor, Point3F position, Vector3F direction, float diffuse, float specular) { Color = diffuseColor; Position = position; Direction = direction; Diffuse = diffuse; Specular = specular; Range = float.PositiveInfinity; ConstantAttenuation = 1; LinearAttenuation = 0.007f; QuadraticAttenuation = 0.0002f; OuterConeAngle = 90; InnerConeAngle = 45; }
public EntityChangedEvent(FFXIVProcess.EntityData e) { if (e != null) { id = e.id; level = e.level; name = e.name; job = e.job.ToString(); currentHP = e.hp; maxHP = e.max_hp; currentMP = e.mp; maxMP = e.max_mp; pos = new Point3F(e.pos_x, e.pos_y, e.pos_z); distance = e.distance; } }
public void DemoPlayerDamage(coPlayerData datablock, coAIPlayer npc, string position, coPlayer sourceobject, float damage, string damageType) { if (!npc.isObject()) { return; } if (npc.getState() == "Dead") { return; } if (damage == 0.0) { return; } npc.applyDamage(damage); if (npc.getState() == "Dead") { return; } Point3F ejectvel = npc.getVelocity(); if (ejectvel.z <= 0) { ejectvel += new Point3F(0, 0, 5); ejectvel = ejectvel.vectorScale(datablock["mass"].AsFloat()); npc.applyImpulse(npc.getPosition(), ejectvel); } Point3F currentpos = npc.getPosition(); currentpos.x += r.Next(-5, 5); currentpos.y += r.Next(-5, 5); if (npc.getDamageLevel() > 50) { currentpos.x += r.Next(-50, 50); currentpos.y += r.Next(-50, 50); } npc.setMoveDestination(currentpos, false); }
public void AnimateCubeRotation(Graphics g) { snh = Math.Sin(H); csh = Math.Cos(H); a = 0; cs = Math.Cos(a); sn = Math.Sin(a); z = new Point3F(cub[0].x, cub[0].y, 0); cs = Math.Cos(a); sn = Math.Sin(a); cubs = new Point3F[n]; cubpro = new Point[n]; for (var i = 0; i < n; i++) { cubs[i] = new Point3F(0, 0, 0); } Color clr; var pause = 50; var k = 0; while (true) { if (a >= Math.PI) { break; } if ((k % 2) == 0) { clr = Color.White; } else { clr = Color.Red; } k++; ApplyCubeRotation(sn, cs); for (var i = 0; i < n; i++) { cubpro[i].X = (int)Math.Round(cubs[i].y - rd * cubs[i].z); cubpro[i].Y = (int)Math.Round(cubs[i].x - rd * cubs[i].z); } DrawCube(g, new Pen(clr, 1)); Thread.Sleep(pause); cs = cs * csh - sn * snh; sn = cs * snh + sn * csh; a = a + H; g.Clear(Color.White); } }
public override void undo() { DecalEditorGui DecalEditorGui = "DecalEditorGui"; int count = Util.getWordCount(this["oldTransformData"]); if (this["instanceId"] != "" && count == 7) { string[] data = this["newTransformData"].Split(' '); Point3F pos = new Point3F(data[0].AsFloat(), data[1].AsFloat(), data[2].AsFloat()); Point3F tan = new Point3F(data[3].AsFloat(), data[4].AsFloat(), data[5].AsFloat()); float size = data[6].AsFloat(); DecalEditorGui.editDecalDetails(this["instanceId"].AsUint(), pos, tan, size); DecalEditorGui.syncNodeDetails(); DecalEditorGui.selectDecal(this["instanceId"].AsUint()); } }
private static Polyline adjust_closed_startpoint(Polyline poly, Point2F startpoint) { Vector2F normal = Vector2F.Undefined; int nearest_seg = 0; Point3F nearest_pt = poly.GetNearestPoint(startpoint, ref normal, ref nearest_seg, true); if (nearest_seg >= 0) { int seg = poly.InsertPoint((Point2F)nearest_pt, (double)CamBamConfig.Defaults.GeneralTolerance); if (seg >= 0) { poly = poly.ToNewStartPoint(seg); } } return(poly); }
public override void damage(ShapeBase obj, Point3F position, GameBase source, float damage, string damagetype) { if (obj.getDamageState() == "Dead") { return; } obj.applyDamage(damage); for (int i = 0; i < this["numMountPoints"].AsInt(); i++) { Player player = obj.getMountNodeObject(i); if (player != 0) { player.damage(source, position, 10000.0f, ""); } } }
private List <Polyline> calc_visual_rapids(List <Toolpath> toolpaths) { List <Polyline> rapids = new List <Polyline>(); double thres = base.GetDistanceThreshold(); Point3F lastpt = Point3F.Undefined; // rapids are possible only between depth levels of pocket and separate pockets foreach (Toolpath path in toolpaths) { if (!lastpt.IsUndefined) { Point3F to; if (path.Leadin != null) { to = path.Leadin.FirstPoint; } else { to = (Point3F)path.Trajectory[0].FirstPoint; } double dist = Point2F.Distance((Point2F)lastpt, (Point2F)to); if (dist > thres + (double)CamBamConfig.Defaults.GeneralTolerance) { // rapid here from last to first point of pocket Polyline p = new Polyline(); p.Add(lastpt); p.Add(new Point3F(lastpt.X, lastpt.Y, ClearancePlane.Cached)); p.Add(new Point3F(to.X, to.Y, ClearancePlane.Cached)); p.Add(new Point3F(to.X, to.Y, path.Bottom + to.Z)); rapids.Add(p); } } lastpt = path.Trajectory[path.Trajectory.Count - 1].LastPoint; lastpt = new Point3F(lastpt.X, lastpt.Y, path.Bottom); } return(rapids); }
/// <summary> /// Customized container radius search which returns a list of simobject ID's in the radius. /// </summary> /// <param name="p"> </param> /// <param name="searchradius"> </param> /// <param name="searchmask"> </param> /// <param name="useclientcontainer"> </param> /// <returns> </returns> internal List <UInt32> ContainerRadiusSearch(Point3F p, double searchradius, UInt32 searchmask, bool useclientcontainer) { uint[] foundid = new UInt32[100]; List <uint> lid = new List <uint>(); Int32 countof = SafeNativeMethods.mContainerRadiusSearch(p.x, p.y, p.z, (float)searchradius, searchmask, useclientcontainer, foundid); if (countof > 0) { for (int i = 0; i < foundid.GetUpperBound(0); i++) { lid.Add(foundid[i]); } } return(lid); }
public void ReadNormalVector(ref Point3F vec, byte angleBitCount, byte zBitCount) { if (ReadFlag()) { vec.Z = ReadFlag() ? -1.0f : 1.0f; vec.X = 0.0f; vec.Y = 0.0f; } else { vec.Z = ReadSignedFloat(zBitCount); var angle = Float2Pi * ReadSignedFloat(angleBitCount); var mult = (float)Math.Sqrt(1.0f - vec.Z * vec.Z); vec.X = mult * (float)Math.Cos(angle); vec.X = mult * (float)Math.Sin(angle); } }
public void RadiusDamage(coShapeBase sourceobject, Point3F position, float radius, float damage, string damageType, float impulse) { // Use the container system to iterate through all the objects // within our explosion radius. We'll apply damage to all ShapeBase // objects. Dictionary <uint, float> r = console.initContainerRadiusSearch(new Point3F(position), radius, (uint)SceneObjectTypesAsUint.ShapeBaseObjectType); float halfRadius = radius / (float)2.0; foreach (coPlayer targetObject in r.Keys) { // Calculate how much exposure the current object has to // the explosive force. The object types listed are objects // that will block an explosion. If the object is totally blocked, // then no damage is applied. UInt32 mask = (uint)SceneObjectTypesAsUint.TerrainObjectType | (uint)SceneObjectTypesAsUint.StaticShapeObjectType | (uint)SceneObjectTypesAsUint.VehicleObjectType; float coverage = Util.calcExplosionCoverage(new Point3F(position), targetObject, mask); if (!coverage.AsBool()) { continue; } float dist = r[targetObject]; // Calculate a distance scale for the damage and the impulse. // Full damage is applied to anything less than half the radius away, // linear scale from there. float distScale = (float)((dist < halfRadius) ? 1.0 : 1 - ((dist - halfRadius) / halfRadius)); // Apply the damage ShapeBaseDamage(targetObject, sourceobject, position, (((damage) * coverage * distScale)), damageType); // Apply the impulse if (!impulse.AsBool()) { continue; } TransformF impulseVec = new TransformF(targetObject.getWorldBoxCenter()) - new TransformF(position); impulseVec = impulseVec.normalizeSafe(); impulseVec = impulseVec.vectorScale(impulse * distScale); targetObject.applyImpulse(new Point3F(position), impulseVec.MPosition); } }
public string ShapeBaseTossPatch(coShapeBase thisobj) { if (!thisobj.isObject()) { return(string.Empty); } coItem item = console.Call_Classname("ItemData", "CreateItem", new[] { "HealthKitPatch" }); item["istemp"] = true.AsString(); item["sourceObject"] = thisobj; item["static"] = false.AsString(); (( coSimSet)"MissionCleanup").pushToBack(item); Random r = new Random(); Point3F vec = new Point3F(-1 + (float)r.NextDouble() * 2, -1 * (float)r.NextDouble() * 2, (float)r.NextDouble()); vec = vec.vecotrScale(10); Point3F eye = thisobj.getEyeVector(); float dot = new Point3F("0 0 1 ").vectorDot(eye); if (dot < 0) { dot = -dot; } vec = vec + new Point3F("0 0 8").vecotrScale(1 - dot); vec = vec + thisobj.getVelocity(); TransformF pos = new TransformF(thisobj.getWorldBox().minExtents); item.setTransform(pos); item.applyImpulse(pos.MPosition, vec); item.setCollisionTimeout(thisobj); item.call("schedulePop"); return(item); }
public string tossPatch() { if (!isObject()) { return(string.Empty); } Item item = ItemData.createItem("HealthKitPatch"); item["istemp"] = true.AsString(); item["sourceObject"] = this; item["static"] = false.AsString(); ((SimSet)"MissionCleanup").pushToBack(item); Random r = new Random(); Point3F vec = new Point3F(-1 + (float)r.NextDouble() * 2, -1 * (float)r.NextDouble() * 2, (float)r.NextDouble()); vec = vec.vecotrScale(10); Point3F eye = getEyeVector(); float dot = new Point3F("0 0 1 ").vectorDot(eye); if (dot < 0) { dot = -dot; } vec = vec + new Point3F("0 0 8").vecotrScale(1 - dot); vec = vec + getVelocity(); TransformF pos = new TransformF(getWorldBox().Get_MinExtents()); item.setTransform(pos); item.applyImpulse(pos.GetPosition(), vec); item.setCollisionTimeout(this); item.SchedulePop(); return(item); }
/// <summary> /// Returns all the points along a line, using linear interpolation. /// </summary> /// <param name="vertexA"></param> /// <param name="vertexB"></param> /// <returns></returns> public IEnumerable <HexagonCell> GetLine(HexagonCell vertexA, HexagonCell vertexB) { float n = this.GetDistance(vertexA, vertexB); List <HexagonCell> results = new List <HexagonCell>(); for (int i = 0; i <= n; i++) { float t = 1.0F / n * i; Point3F cubeLerped = this.GetLerpCube(vertexA.Location, vertexB.Location, t); Point3I cubeRounded = this.GetCubeRounded(cubeLerped); HexagonCell oCell = this.GetCell(cubeRounded); if (oCell != null) { results.Add(oCell); } } return(results); }
public void ServerCmdcarUnmountObj(coGameConnection client, coPlayer obj) { obj.unmount(); obj.setControlObject(obj); TransformF ejectpos = obj.getTransform(); ejectpos += new TransformF(0, 0, 5); obj.setTransform(ejectpos); coVehicle mvehicle = obj["mVehicle"]; Point3F ejectvel = mvehicle.getVelocity(); ejectvel += new Point3F(0, 0, 10); ejectvel = ejectvel.vectorScale(((coSimDataBlock)(obj.getDataBlock()))["mass"].AsFloat()); obj.applyImpulse(ejectpos.MPosition, ejectvel); }
private Vector3 computeNorm(int[] triangle, List <Point3F> Vertics) { Point3F a = Vertics[triangle[0]]; Point3F b = Vertics[triangle[1]]; Point3F c = Vertics[triangle[2]]; Vector3 U = new Vector3( b.x - a.x, b.y - a.y, b.z - a.z ); Vector3 V = new Vector3( c.x - a.x, c.y - a.y, c.z - a.z ); return(U.CrossProduct(V).NormalisedCopy); }
public PlayerChangedEvent(FFXIVProcess.EntityData e) { id = e.id; level = e.level; name = e.name; job = e.job.ToString(); currentHP = e.hp; maxHP = e.max_hp; currentMP = e.mp; maxMP = e.max_mp; maxTP = 1000; currentGP = e.gp; maxGP = e.max_gp; currentCP = e.cp; maxCP = e.max_cp; pos = new Point3F(e.pos_x, e.pos_y, e.pos_z); jobDetail = null; bait = e.bait; debugJob = e.debug_job; }
public override void onCollision(ShapeBase obj, SceneObject collObj, Point3F vec, float len) { if (!((collObj.GetType() == typeof(Player)) || (collObj.GetType() == typeof(AIPlayer)))) { return; } Player player = (Player)collObj; if (player.getDamageLevel() <= 0.00 || player.getState() == "Dead") { return; } player.applyRepair(this["repairAmount"].AsFloat()); player.setEnergyLevel(1); obj.schedule((100).AsString(), "startFade", "1000", "0", "true"); obj.schedule((1200).AsString(), "delete"); Audio.AudioServerPlay3D("HealthUseSound", player.getTransform()); }
//------------------------------------------------------------------- void bezier_01(Point3F[] p) { int i, k, n = p.Length; for (k = n - 1; k > 0; k--) { Point3F p0 = p [0]; trace("bezier: " + p0.ToString()); _poly.Add(p0); for (i = 0; i < k; i++) { p [i] = midpoint(p [i], p [i + 1]); } } for (i = 0; i < n; i++) { Point3F p0 = p [i]; trace("bezier: " + p0.ToString()); _poly.Add(p0); //_poly.Add(p[i]); } }
void OnGUI() { if (GUILayout.Button("Invoke C++ Dll")) { IntPtr ptr = hd_init(null); Point3F hand_center = new Point3F(); Point3F[] fingertips = new Point3F[5]; IntPtr fingersPtr = Marshal.UnsafeAddrOfPinnedArrayElement(fingertips, 0); IntPtr ir_img = Marshal.AllocHGlobal(2); //IntPtr.Zero; IntPtr depth_img = Marshal.AllocHGlobal(2); //IntPtr.Zero; int fingerNum = hd_get_fingers(ptr, ir_img, depth_img, 224, 171, ref hand_center, fingertips, 5); Debug.Log("fingernum : " + fingerNum); // 释放 Marshal.FreeHGlobal(ir_img); Marshal.FreeHGlobal(depth_img); Debug.Log(hd_release(ptr)); } }
public void DrawPixel(int x, int y, Point3F point1, Point3F point2, Point3F point3, float[,] pointsColors, ref int zBuf) { Color pixelValue; Point3F drawingPoint; drawingPoint.x = x; drawingPoint.y = y; float l1, l2, l3; l1 = ((point2.y - point3.y) * (x - point3.x) + (point3.x - point2.x) * (y - point3.y)) / ((point2.y - point3.y) * (point1.x - point3.x) + (point3.x - point2.x) * (point1.y - point3.y)); l2 = ((point3.y - point1.y) * (x - point3.x) + (point1.x - point3.x) * (y - point3.y)) / ((point2.y - point3.y) * (point1.x - point3.x) + (point3.x - point2.x) * (point1.y - point3.y)); l3 = 1 - l1 - l2; if (l1 >= 0 && l2 >= 0 && l3 >= 0) { drawingPoint.z = (float)(point1.z * l1 + point2.z * l2 + point3.z * l3); pixelValue = textureBitmap.GetPixel(((int)(pointsColors[0, 0] * l1 + pointsColors[1, 0] * l2 + pointsColors[2, 0] * l3) % textureBitmap.Width), (textureBitmap.Height - (int)(pointsColors[0, 1] * l1 + pointsColors[1, 1] * l2 + pointsColors[2, 1] * l3)) % textureBitmap.Height); SetPixel(drawingPoint, pixelValue, ref zBuf); } }
public virtual void autoFocus() { GameConnection serverconnection = "ServerConnection"; ShapeBase camera = serverconnection.getCameraObject(); const uint mask = (uint)(SceneObjectTypesAsUint.StaticObjectType | SceneObjectTypesAsUint.TerrainObjectType); Point3F fvec = camera.getEyeVector(); Point3F start = camera.getEyePoint(); Point3F end = Util.VectorAdd(start, Util.VectorScale(fvec, fGlobal["$Param::FarDist"])); string result = Util.containerRayCast(start, end, mask, camera, true); string hitPos = Util.getWords(result, 1, 3); string focDist = sGlobal["$Param::FarDist"]; if (hitPos != string.Empty) { focDist = Util.VectorDist(new Point3F(hitPos), start).AsString(); } this["focalDist"] = focDist; }
public static void RadiusDamage(GameBase sourceobject, Point3F position, float radius, float damage, string damageType, float impulse) { // Use the container system to iterate through all the objects // within our explosion radius. We'll apply damage to all ShapeBase // objects. Dictionary<uint, float> r = tst.console.initContainerRadiusSearch(position, radius, (uint) SceneObjectTypesAsUint.ShapeBaseObjectType); float halfRadius = radius/(float) 2.0; foreach (ShapeBase targetObject in r.Keys) { // Calculate how much exposure the current object has to // the explosive force. The object types listed are objects // that will block an explosion. If the object is totally blocked, // then no damage is applied. UInt32 mask = (uint) SceneObjectTypesAsUint.TerrainObjectType | (uint) SceneObjectTypesAsUint.StaticShapeObjectType | (uint) SceneObjectTypesAsUint.VehicleObjectType; float coverage = tst.Util.calcExplosionCoverage(new Point3F(position), targetObject, mask); if (!coverage.AsBool()) continue; float dist = r[targetObject]; // Calculate a distance scale for the damage and the impulse. // Full damage is applied to anything less than half the radius away, // linear scale from there. float distScale = (float) ((dist < halfRadius) ? 1.0 : 1 - ((dist - halfRadius)/halfRadius)); // Apply the damage targetObject.damage(sourceobject, position, (((damage)*coverage*distScale)), damageType); // Apply the impulse if (!impulse.AsBool()) continue; TransformF impulseVec = new TransformF(targetObject.getWorldBoxCenter()) - new TransformF(position); impulseVec = impulseVec.normalizeSafe(); impulseVec = impulseVec.vectorScale(impulse*distScale); targetObject.applyImpulse(new Point3F(position), impulseVec.GetPosition()); } }
public void DrawTriangle(VertexParam coordinate1, VertexParam coordinate2, VertexParam coordinate3, VertexParam point1texture, VertexParam point2texture, VertexParam point3texture, ref int[,] zbuffer) { Point3F point1 = ConvertToRange(coordinate1); Point3F point2 = ConvertToRange(coordinate2); Point3F point3 = ConvertToRange(coordinate3); int x0 = (int)Math.Floor(Math.Min(point1.x, Math.Min(point2.x, point3.x))); int x1 = (int)Math.Ceiling(Math.Max(point1.x, Math.Max(point2.x, point3.x))); int y0 = (int)Math.Floor(Math.Min(point1.y, Math.Min(point2.y, point3.y))); int y1 = (int)Math.Ceiling(Math.Max(point1.y, Math.Max(point2.y, point3.y))); float[,] convertedTextureCoordinates = new float[3, 2]; VertexParam[] verticesTextures = new VertexParam[3]; verticesTextures[0] = point1texture; verticesTextures[1] = point2texture; verticesTextures[2] = point3texture; convertedTextureCoordinates = ConvertToTexture(verticesTextures); if ((x1 > width && y1 > height && x0 > height && y0 > height) || (x0 < 0 && x1 < 0 && y0 < 0 && y1 < 0)) { return; // Проверка выхода прямоугольника за пределы рисуемого объекта } else { x0 = x0 < 0 ? 0 : x0; // Проверка частичного выхода прямоугольника за пределы рисуемого объекта (и исправление) y0 = y0 < 0 ? 0 : y0; x1 = x1 > width ? width : x1; y1 = y1 > height ? height : y1; for (int x = x0; x < x1; x++) { for (int y = y0; y < y1; y++) { DrawPixel(x, y, point1, point2, point3, convertedTextureCoordinates, ref zbuffer[x, y]); } } } }
public void DOFPostEffectautoFocus(coPostEffect thisobj) { try { coGameConnection serverconnection = "ServerConnection"; coCamera camera = serverconnection.getCameraObject(); uint mask = (uint)(WinterLeaf.Enums.SceneObjectTypesAsUint.StaticObjectType | WinterLeaf.Enums.SceneObjectTypesAsUint.TerrainObjectType); //string control = GameConnection.getCameraObject("ServerConnection"); //console.Call("ServerConnection", "getCameraObject"); Point3F fvec = camera.getEyeVector(); Point3F start = camera.getEyePoint(); //Point3F fvec = ShapeBase.getEyeVector(control); // console.Call(control, "getEyeVector"); //Point3F start = ShapeBase.getEyePoint(control); // console.Call(control, "getEyePoint"); Point3F end = Util.VectorAdd(start, Util.VectorScale(fvec, fGlobal["$Param::FarDist"])); string result = Util.containerRayCast(start, end, mask, camera, true); string hitPos = Util.getWords(result, 1, 3); string focDist = sGlobal["$Param::FarDist"]; if (hitPos != "") { focDist = Util.VectorDist(new Point3F(hitPos), start).AsString(); } thisobj["focalDist"] = focDist; } catch (Exception) { //Do nothing, this only gets hit when it can't find the serverconnection or the camera. } }
public virtual void onCollision(ShapeBase obj, SceneObject collObj, Point3F vec, float len){}
public override void damage(ShapeBase obj, Point3F position, GameBase source, float damage, string damagetype) { if (obj.getDamageState() == "Dead") return; obj.applyDamage(damage); for (int i = 0; i < this["numMountPoints"].AsInt(); i++) { Player player = obj.getMountNodeObject(i); if (player != 0) player.damage(source, position, 10000.0f, ""); } }
public virtual void onCollision(Projectile proj, SceneObject col, float fade, Point3F pos, Point3F normal){}
public virtual void onExplode(Projectile proj, Point3F pos, float fade){}
public override void onAdd(GameBase obj) { WheeledVehicle vehicle = obj._ID; base.onAdd(obj); WheeledVehicleTire CheetahCarTire = "CheetahCarTire"; WheeledVehicleTire CheetahCarTireRear = "CheetahCarTireRear"; WheeledVehicleSpring CheetahCarSpring = "CheetahCarSpring"; //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 ObjectCreator tc = new ObjectCreator("PointLight", ""); tc["radius"] = 1; tc["isEnabled"] = false; tc["color"] = new ColorF(1, 0, 0.141176f, 1); // , @"""1 0 0.141176 1"""); tc["brightness"] = 2; tc["castShadows"] = true; tc["priority"] = 1; tc["animate"] = false; tc["animationPeriod"] = 1; tc["animationPhase"] = 1; tc["flareScale"] = 1; tc["attenuationRatio"] = new Point3F(0, 1, 1); //, @"""0 1 1"""); tc["shadowType"] = "\"DualParaboloidSinglePass\""; tc["texSize"] = 512; tc["overDarkFactor"] = new Point4F(2000, 1000, 500, 100); //, @"""2000 1000 500 100"""); tc["shadowDistance"] = 400; // "400"); tc["shadowSoftness"] = 0.15; tc["numSplits"] = 1; //, "1"); tc["logWeight"] = 0.91; tc["fadeStartDistance"] = 0; //, "0"); tc["lastSplitTerrainOnly"] = false; tc["representedInLightmap"] = false; //, "0"); tc["shadowDarkenColor"] = new ColorF(0, 0, 0, -1); //, @"""0 0 0 -1"""); tc["includeLightmappedGeometryInShadow"] = false; //, "0"); tc["rotation"] = new AngAxisF(1, 0, 0, 0); //, @"""1 0 0 0 """); tc["canSave"] = true; //, "1"); tc["canSaveDynamicFields"] = true; //, "1"); tc["splitFadeDistances"] = "10 20 30 40"; vehicle["rightBrakeLight"] = ((PointLight) tc.Create()); vehicle["leftBrakeLight"] = ((PointLight) tc.Create()); vehicle["inv[BulletAmmo]"] = "1000"; // Mount a ShapeBaseImageData vehicle.mountImage("TurretImage", this["turretSlot"].AsInt(), true, string.Empty); // Mount the brake lights vehicle.mountObject(vehicle["rightBrakeLight"], this["rightBrakeSlot"].AsInt(), new TransformF()); vehicle.mountObject(vehicle["leftbrakelight"], this["leftBrakeSlot"].AsInt(), new TransformF()); }
public virtual void applyTorque(Point3F torque) { InternalUnsafeMethods.applyTorque(ObjectPtr, torque.ToStruct()); }
public virtual void damage(ShapeBase obj, Point3F position, GameBase source, float damage, string damagetype) { // Ignore damage by default. This empty method is here to // avoid console warnings. }
public void setLightDirection(Point3F direction){ pInvokes.m_ts.fnGuiObjectView_setLightDirection(_ID, direction.AsString()); }
public void renderSphere(Point3F pos, float radius, int sphereLevel = 0) { pInvokes.m_ts.fnEditTSCtrl_renderSphere(_ID, pos.AsString(), radius, sphereLevel); }
public void setNodePosition(Point3F pos){ pInvokes.m_ts.fn_GuiRiverEditorCtrl_setNodePosition(_ID, pos.AsString()); }
public override void damage(GameBase sourceobject, Point3F position, float damage, string damagetype) { ((TurretShapeData) (getDataBlock())).damage(this, position, sourceobject, damage, damagetype); }
public void attach(Point3F start, Point3F direction, float maxDist){ pInvokes.m_ts.fnPhysicsForce_attach(_ID, start.AsString(), direction.AsString(), maxDist); }
public virtual void onImpact(ShapeBase obj, SceneObject collObj, Point3F vec, float len){}
public int addLink(Point3F from, Point3F to, uint flags = 0){ return pInvokes.m_ts.fnNavMesh_addLink(_ID, from.AsString(), to.AsString(), flags); }
public void detach(Point3F force = null ){ if (force== null) {force = new Point3F(0.0f, 0.0f, 0.0f);} pInvokes.m_ts.fnPhysicsForce_detach(_ID, force.AsString()); }
public override void onExplode(ProximityMine obj, Point3F pos) { if (this["damageRadius"].AsFloat() > 0) radiusDamage.RadiusDamage(obj, pos, this["damageRadius"].AsFloat(), this["radiusDamage"].AsFloat(), this["damageType"], this["areaImpulse"].AsFloat()); }
public void setNodeNormal(Point3F normal){ pInvokes.m_ts.fn_GuiRiverEditorCtrl_setNodeNormal(_ID, normal.AsString()); }
public override void damage(ShapeBase obj, Point3F position, GameBase source, float damage, string damagetype) { // Explode if any damage is applied to the mine int r = 50 + (new Random().Next(0, 50)); schedule(r.AsString(), "explode"); }
public static void clientCmdPlayTeleportEffect(Point3F position, SimDataBlock effectDataBlock) { if (!effectDataBlock.isObject()) return; ObjectCreator tch = new ObjectCreator("Explosion"); tch["position"] = position.AsString(); tch["datablock"] = effectDataBlock; tch.Create(); }
public override void damage(GameBase sourceobject, Point3F position, float damage, string damagetype) { if (!isObject()) return; if (getState() == "Dead") return; if (damage == 0.0) return; applyDamage(damage); if (getState() == "Dead") return; Point3F ejectvel = getVelocity(); if (ejectvel.z <= 0) { ejectvel += new Point3F(0, 0, 5); SimDataBlock d = getDataBlock(); if (d.isObject()) ejectvel = ejectvel.vectorScale(d["mass"].AsFloat()); applyImpulse(getPosition(), ejectvel); } Point3F currentpos = getPosition(); currentpos.x += r.Next(-5, 5); currentpos.y += r.Next(-5, 5); if (getDamageLevel() > 50) { currentpos.x += r.Next(-50, 50); currentpos.y += r.Next(-50, 50); } setMoveDestination(currentpos, false); }
public Point3F project(Point3F worldPosition){ return new Point3F ( pInvokes.m_ts.fnGuiTSCtrl_project(_ID, worldPosition.AsString())); }
public void renderTriangle(Point3F a, Point3F b, Point3F c) { pInvokes.m_ts.fnEditTSCtrl_renderTriangle(_ID, a.AsString(), b.AsString(), c.AsString()); }
public Point3F unproject(Point3F screenPosition){ return new Point3F ( pInvokes.m_ts.fnGuiTSCtrl_unproject(_ID, screenPosition.AsString())); }
public virtual void applyForce(Point3F force) { InternalUnsafeMethods.applyForce(ObjectPtr, force.ToStruct()); }
public void setTurretEulerRotation(Point3F rot){ pInvokes.m_ts.fnTurretShape_setTurretEulerRotation(_ID, rot.AsString()); }
public void drawLine(Point3F a, Point3F b, ColorF color = null ){ if (color== null) {color = new ColorF(1.0f, 1.0f, 1.0f,1.0f);} pInvokes.m_ts.fnDebugDrawer_drawLine(_ID, a.AsString(), b.AsString(), color.AsString()); }
public int getLink(Point3F pos){ return pInvokes.m_ts.fnNavMesh_getLink(_ID, pos.AsString()); }
/// <summary> /// Set the object's scale. /// @param scale object scale to set ) /// /// </summary> public void setScale(Point3F scale) { TorqueScriptTemplate.m_ts.fnSceneObject_setScale(_mSimObjectId, scale.AsString()); }
public TransformF getDeployTransform(Point3F pos, Point3F normal){ return new TransformF ( pInvokes.m_ts.fnShapeBaseData_getDeployTransform(_ID, pos.AsString(), normal.AsString())); }