public MobileState(Mobile mob) { ObjectInstanceId = mob.ObjectInstanceId; State = mob.MobileState; Position = mob.Position; Rotation = mob.Rotation; }
public MyPosition(int possessingId, Vector3D position, Quaternion rotation, EnumMobileState state) { PossessingId = possessingId; Position = position; Rotation = rotation; State = state; }
public MobileState(EntityModel mob) { ObjectInstanceId = mob.Id; State = mob.MobileState; Position = mob.Position; Rotation = mob.Rotation; }
public MyPosition(int possessingId, Vector3D position, Quaternion rotation, EnumMobileState mobileState) { PossessingId = possessingId; Position = position; Rotation = rotation; MobileState = mobileState; }
public CombatantModel(int id, string name, string modelId, Vector3D position, Quaternion rotation, float health, float energy, EnumMobileState mobileState, float height, int constitution, int dexterity, int willpower, int cognition, int strength) : base(id, name, modelId, position, rotation, health, energy, mobileState, height) { Constitution = constitution; Dexterity = dexterity; Willpower = willpower; Cognition = cognition; Strength = strength; ActivatingSkill = EnumSkill.None; SkillQueue = ListModule.Empty<Tuple<EnumSkill, EntityModel>>(); }
public Mobile( Schema.TemplateMobileRow mobile, Schema.TemplateObjectRow template, Schema.ObjectInstanceRow instance ) : base(template, instance) { Level = mobile.Level; Cognition = mobile.Cognition; Willpower = mobile.Willpower; Dexterity = mobile.Dexterity; Strength = mobile.Strength; Constitution = mobile.Constitution; Race = (EnumRace)mobile.EnumRaceID; MobileSize = (EnumMobileSize)mobile.EnumMobileSizeID; MobileState = (EnumMobileState)mobile.EnumMobileStateID; MaxHitPoints = mobile.EnumMobileSizeID * 100 + Level * Constitution / 2; HitPoints = (float)instance.HitpointsCurrent; MaxEnergy = mobile.EnumMobileSizeID * 100 + Level * Constitution / 2; Energy = (float)instance.EnergyCurrent; Possessable = instance.GetMobilePossesableByPlayerRows().Length > 0; }
public void SetMobileState(EnumMobileState ms) { if (MobileState == ms) { return; } MobileState = ms; // TODO: this will probably change if we use anything more // advance than stick to ground. // changing state may have moved the mobile. double?altitude = World.AltitudeAt(Position.X, Position.Z) + CurrentHeight / 2; if (altitude.HasValue) { Position.Y = altitude.Value; } // MobileState message has position info // as it is likely that this will have changed World.InformNearby(this, new ToClient.MobileState(this)); }
public void Move(int key, EnumMobileState state, Vector3D position, Quaternion rotation, DateTime when) { Add(GetEntity(key).Move(state, position, rotation, when)); }
private void ApplyKeyBindings(double deltaT) { int movementPerpendicular = 0; int movementForward = 0; int movementUp = 0; double speedModifier = 1; foreach (InputBindings.KeyBinding kb in WorldViewModel.InputBindings.KeyBindings .Where(kb => kb.KeyCombo.All(k => _keyPressed(k)))) { UnFollow(); if (kb.Action == InputBindings.KeyAction.Up) movementUp++; else if (kb.Action == InputBindings.KeyAction.Down) movementUp--; else if (kb.Action == InputBindings.KeyAction.Left) movementPerpendicular++; else if (kb.Action == InputBindings.KeyAction.Right) movementPerpendicular--; else if (kb.Action == InputBindings.KeyAction.TurnLeft) Heading += deltaT * 200; else if (kb.Action == InputBindings.KeyAction.TurnRight) Heading -= deltaT * 200; else if (kb.Action == InputBindings.KeyAction.TiltUp) Tilt += deltaT * (AngleRangeHigh - AngleRangeLow) / 2.0; else if (kb.Action == InputBindings.KeyAction.TiltDown) Tilt -= deltaT * (AngleRangeHigh - AngleRangeLow) / 2.0; else if (kb.Action == InputBindings.KeyAction.Walk) speedModifier = 0.2; else if (kb.Action == InputBindings.KeyAction.Forward) movementForward++; else if (kb.Action == InputBindings.KeyAction.Back) movementForward--; else if (kb.Action == InputBindings.KeyAction.Home) Home.Execute(null); else if (kb.Action == InputBindings.KeyAction.FollowSelected) FollowSelected.Execute(null); else if (kb.Action == InputBindings.KeyAction.Possess) PossessEntity.Execute(null); else if (kb.Action == InputBindings.KeyAction.Create) _actionState = InputBindings.ActionState.CreateAction; else throw new Exception("Unexpected keyboard binding " + kb.Action); } // Set Position and Rotation Rotation = new Quaternion(ZAxis, Heading) * new Quaternion(YAxis, -Tilt); if (movementPerpendicular == 0 && movementForward == 0 && movementUp == 0) { MobileState = EnumMobileState.Standing; return; } if (speedModifier < 1) MobileState = EnumMobileState.Walking; else MobileState = EnumMobileState.Running; var transformHeading = new Matrix3D(); transformHeading.Rotate(new Quaternion(ZAxis, Heading)); var changeInPosition = new Vector3D( movementForward * _landSpeed, movementPerpendicular * _landSpeed, movementUp * (DistanceRangeHigh - DistanceRangeLow) / 10.0); Position += changeInPosition * transformHeading * deltaT * speedModifier; if (Position.Z < DistanceRangeLow) Position.Z = DistanceRangeLow; else if (Position.Z > DistanceRangeHigh) Position.Z = DistanceRangeHigh; }
public void MyPosition(int possessingId, Vector3D position, Quaternion rotation, EnumMobileState state) { Send(new MyPosition(possessingId, position, rotation, state)); }
private void ApplyKeyBindings(double deltaT) { int movementPerpendicular = 0; int movementForward = 0; int movementUp = 0; double speedModifier = 1; foreach (InputBindings.KeyBinding kb in WorldViewModel.Bindings.KeyBindings .Where(kb => kb.KeyCombo.All(k => _keyPressed(k)))) { UnFollow(); if (kb.Action == InputBindings.KeyAction.Up) { movementUp++; } else if (kb.Action == InputBindings.KeyAction.Down) { movementUp--; } else if (kb.Action == InputBindings.KeyAction.Left) { movementPerpendicular++; } else if (kb.Action == InputBindings.KeyAction.Right) { movementPerpendicular--; } else if (kb.Action == InputBindings.KeyAction.TurnLeft) { Heading += deltaT * 200; } else if (kb.Action == InputBindings.KeyAction.TurnRight) { Heading -= deltaT * 200; } else if (kb.Action == InputBindings.KeyAction.TiltUp) { Tilt += deltaT * (AngleRangeHigh - AngleRangeLow) / 2.0; } else if (kb.Action == InputBindings.KeyAction.TiltDown) { Tilt -= deltaT * (AngleRangeHigh - AngleRangeLow) / 2.0; } else if (kb.Action == InputBindings.KeyAction.Walk) { speedModifier = 0.2; } else if (kb.Action == InputBindings.KeyAction.Forward) { movementForward++; } else if (kb.Action == InputBindings.KeyAction.Back) { movementForward--; } else if (kb.Action == InputBindings.KeyAction.Home) { Home.Execute(null); } else if (kb.Action == InputBindings.KeyAction.FollowSelected) { FollowSelected.Execute(null); } else if (kb.Action == InputBindings.KeyAction.Possess) { PossessEntity.Execute(null); } else if (kb.Action == InputBindings.KeyAction.Create) { _actionState = InputBindings.ActionState.CreateAction; } else { throw new Exception("Unexpected keyboard binding " + kb.Action); } } // Set Position and Rotation Rotation = new Quaternion(ZAxis, Heading) * new Quaternion(YAxis, -Tilt); if (movementPerpendicular == 0 && movementForward == 0 && movementUp == 0) { MobileState = EnumMobileState.Standing; return; } if (speedModifier < 1) { MobileState = EnumMobileState.Walking; } else { MobileState = EnumMobileState.Running; } var transformHeading = new Matrix3D(); transformHeading.Rotate(new Quaternion(ZAxis, Heading)); var changeInPosition = new Vector3D( movementForward * _landSpeed, movementPerpendicular * _landSpeed, movementUp * (DistanceRangeHigh - DistanceRangeLow) / 10.0); Position += changeInPosition * transformHeading * deltaT * speedModifier; if (Position.Z < DistanceRangeLow) { Position.Z = DistanceRangeLow; } else if (Position.Z > DistanceRangeHigh) { Position.Z = DistanceRangeHigh; } }
public static void UpdatePhone(string serialNumber, EnumMobileState state) { PhoneDic[serialNumber].MobileState = state; }
private EntityModel CreateEntityFromTemplate(int templateId, Vector3D position, Quaternion rotation, EnumMobileState mobileState) { var id = Global.Rand.Next(); while (History.Head.Entities.ContainsKey(id)) { id = Global.Rand.Next(); } return new EntityModel(id, "Creation"+templateId, "RTSRobot", position, rotation, 100, 100, mobileState, 1.7f); }