private void Awake() { if (!_next) Debug.Log ("This waypoint is not connected,you need to set the next waypoint!", this); if (_isStart) _start = this; }
public Queue(ulong id, Map map, WayPoint location) { Id = id; _map = map; base.Dislocation = location; _servicePoint = new Point(location.X, location.Y); }
public WayPointViewModel(IEnumerable<ServiceModel> services, IEnumerable<WayPoint> links, WayPoint wayPoint = null) { if (wayPoint == null) { wayPoint = new WayPoint(0, 0, 0, 5, 5); } _services = services; _links = links.Where(wp => wp.LayerId != wayPoint.LayerId); _wayPoint = wayPoint; _x = wayPoint.X; _y = wayPoint.Y; _width = wayPoint.Width; _height = wayPoint.Height; _name = wayPoint.Name; _isInput = wayPoint.IsInput; _isOutput = wayPoint.IsOutput; _isService = wayPoint.IsServicePoint; if (_isService) { SelectedService = services.FirstOrDefault(s => s.Id == wayPoint.ServiceId); } _isLinked = wayPoint.IsLinked; if (_isLinked) { SelectedLink = wayPoint.LinkedPoint; } }
// Update is called once per frame void Update() { m_desiredHeading = Vector3.zero; if (m_current!=null) { Vector3 planeMovement = new Vector3(m_current.m_pos.x - transform.position.x, 0.0f, m_current.m_pos.z - transform.position.z); m_desiredHeading = Vector3.ClampMagnitude(planeMovement,1.0f); if (m_current.isClose(transform.position)) { m_withinRangeTimeBeforeAcceptTick -= Time.deltaTime; if (m_withinRangeTimeBeforeAcceptTick<=0.0f) { m_current = null; m_withinRangeTimeBeforeAcceptTick = m_withinRangeTimeBeforeAccept; } } else { m_withinRangeTimeBeforeAcceptTick = m_withinRangeTimeBeforeAccept; } } else if (m_waypoints.Count>0) { m_current = m_waypoints.Pop(); } debugDraw(); }
private void closeLoop(WayPoint other) { prev = other; prev.next = this; makeLine (); }
public void ChangeNextWayPoint() { if (wayPoints.Length > 0) { int w_nextWayPoint = (int)Random.Range(0, wayPoints.Length); nextWayPoint = wayPoints[w_nextWayPoint]; } }
public void AddItem(bool Left) { switch (Engine.Singleton.HumanController.HUD.Category) { case HUD.InventoryCategory.WAYPOINT: WayPoint newWayPoint = new WayPoint(); newWayPoint.Position = AimPosition; newWayPoint.DisplayName = Engine.Singleton.CurrentLevel.Name + "_NEW_WP"; Engine.Singleton.ObjectManager.Add(newWayPoint); break; case HUD.InventoryCategory.DESCRIBED: Described newItem = new Described(InventoryItem); if (Left) newItem.Position = AimPosition; else newItem.Position = Camera.Position; if (!Engine.Singleton.HumanController.Gravity) newItem.Body.SetMassMatrix(0, Vector3.ZERO); Engine.Singleton.ObjectManager.Add(newItem); break; case HUD.InventoryCategory.CHARACTER: Character newCharacter = new Character(InventoryCharacter); if (Left) newCharacter.Position = AimPosition; else newCharacter.Position = Camera.Position; if (!Engine.Singleton.HumanController.Gravity) newCharacter.Body.SetMassMatrix(0, Vector3.ZERO); // Console.WriteLine(newCharacter.Position.ToString()); // Console.WriteLine(AimPosition.ToString()); // Console.WriteLine(Camera.Position.ToString()); Engine.Singleton.ObjectManager.Add(newCharacter); break; case HUD.InventoryCategory.ENEMY: Enemy newEnemy = new Enemy(InventoryCharacter); if (Left) newEnemy.Position = AimPosition; else newEnemy.Position = Camera.Position; if (!Engine.Singleton.HumanController.Gravity) newEnemy.Body.SetMassMatrix(0, Vector3.ZERO); // Console.WriteLine(newCharacter.Position.ToString()); // Console.WriteLine(AimPosition.ToString()); // Console.WriteLine(Camera.Position.ToString()); Engine.Singleton.ObjectManager.Add(newEnemy); break; } }
public RendezvousTrajectory(VesselWrapper vsl, Vector3d dV, double startUT, WayPoint target, double min_PeR, double transfer_time = -1) : base(vsl, dV, startUT, target) { MinPeR = min_PeR; TransferTime = transfer_time; TargetOrbit = Target.GetOrbit(); TargetVessel = Target.GetVessel(); update(); }
public void Start() { foreach( var wp in wayPoints ) SetTrigger(wp, false); if( wayPoints.Length > 0 ) { curWP = wayPoints[0]; SetTrigger( curWP, true ); } }
// Use this for initialization void Start() { int cnt = 1; ArrayList wPointList = new ArrayList(); WayPoint wPoint = new WayPoint(); bool LoadingChildren = true; float distance; float dist2; // Create a list of waypoints. foreach (WayPoint wPoint2 in GetComponentsInChildren<WayPoint>()) { wPointList.Add (wPoint2); wPoint.Number = wPointList.Count; } distance = float.MaxValue; // Walk all of the waypoints WayPoint wpStart = new WayPoint(); wpStart.Position = new Vector3(295, 102, 282); // starting point for (int i = 0; i <= this.GetComponentsInChildren<WayPoint>().Length - 1; i++) { int loc = 0; //Debug.Log("------------- ITERATION " + i + " -----------------"); // Walks the waypoints in the list. for (int i2 = 0; i2 <= wPointList.Count - 1; i2++) { dist2 = Vector3.Distance(wpStart.Position, (wPointList[i2] as WayPoint).Position); if (dist2 <= distance) { wPoint = wPointList[i2] as WayPoint; distance = Vector3.Distance(wpStart.Position, (wPointList[i2] as WayPoint).Position); loc = i2; //Debug.Log ("wPoint = " + wPoint.name); } } //Debug.Log ("Removing waypoint " + (wPointList[loc] as WayPoint).name ); distance = float.MaxValue; wPointList.RemoveAt (loc); wPoint.Number = cnt; cnt++; //Debug.Log ("Adding waypoint " + wPoint.name); WayPointList.Add (wPoint); wpStart = wPoint; } foreach (WayPoint wp in WayPointList) { Debug.Log (wp.Number); } }
void Update() { if (Mathf.Abs (Vector3.Distance (wp.transform.position, transform.position)) < 1) wp = wp.nextWayPoint; CharacterController controller = GetComponent<CharacterController>(); //transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0); //Vector3 forward = transform.TransformDirection(Vector3.forward); float curSpeed = speed; //controller.SimpleMove(forward * curSpeed); controller.SimpleMove ((wp.transform.position-transform.position).normalized*speed); }
public void NextWayPoint() { SetTrigger( curWP, false ); var nextIndex = Array.FindIndex( wayPoints, (v) => v == curWP ) + 1; if( nextIndex == wayPoints.Length ) nextIndex = 0; curWP = wayPoints[nextIndex]; SetTrigger( curWP, true ); }
public WayPoint GetNextWaypoint(WayPoint wp) { if (WayPointList.Count == 0) return new WayPoint(); int num = wp.Number + 1; if ((num) > WayPointList.Count -1) { return WayPointList[WayPointList.Count] as WayPoint; } return (WayPointList[num] ) as WayPoint; }
// Use this for initialization void Start() { FieldInfo info = Util.getFieldInfo (field); var bottomLeftCorner = new Vector3 (info.lowerX, info.lowerY, 0); var upperRightCorner = new Vector3 (info.upperX, info.upperY, 0); var blank = wayPointReference; topBound = Instantiate (blank, upperRightCorner, transform.rotation) as WayPoint; bottomBound = Instantiate (blank, bottomLeftCorner, transform.rotation) as WayPoint; leftBound = Instantiate (blank, bottomLeftCorner, transform.rotation) as WayPoint; rightBound = Instantiate (blank, upperRightCorner, transform.rotation) as WayPoint; }
/// <summary> /// Constructor /// </summary> public Session(int maxPos, int maxOrd) { MaxPos = maxPos; MaxOrd = maxOrd; MaxWayPoints = maxOrd + 4; Positions = 0; Orders = 0; WayPoints = 0; Position = new Position[MaxPos]; Order = new Order[MaxOrd]; WayPoint = new WayPoint[MaxWayPoints]; Position[0] = new Position(); BacktestEval = BacktestEval.None; IsTopReached = false; IsBottomReached = false; }
// Use this for initialization void Start() { lRend = gameObject.GetComponent<LineRenderer> (); if (prevSet != null) { prev = prevSet; prev.next = this; makeLine(); } if (firstSet == null) firstSet = this; else firstSet.closeLoop(this); prevSet = this; }
void colaidersAdd(Collider2D collaider) { if (collaiders.Exists(x => x.Collider == collaider)) return; vv3.Add(collaider); Vector2 cuurentPointMax = getMaxSurface(collaider); Vector2 cuurentPointMin = getMinSurface(collaider); var newCollaider = new WayPoint() { Collider = collaider, Point = cuurentPointMin }; collaiders.Add(newCollaider); SetReference(newCollaider); newCollaider = new WayPoint() { Collider = collaider, Point = cuurentPointMax }; collaiders.Add(newCollaider); SetReference(newCollaider); }
// Update is called once per frame void Update() { if (targetWaypoint != null && navAgent.enabled == true) { float delta = Vector3.Distance (targetWaypoint.transform.position, transform.position); //Debug.Log (delta); if (delta < 0.5f) { delayTime += Time.deltaTime; if(delayTime >= targetWaypoint.delay){ targetWaypoint = targetWaypoint.nextWayPoint; // swap to next in chain... delayTime =0; } } if (navAgent.enabled == true && targetWaypoint !=null) { navAgent.SetDestination (targetWaypoint.transform.position); } } }
public WayPoint GetNearestWayPoint(Vector3 position, ArrayList wpl) { WayPoint wp = new WayPoint(); float distance = float.MaxValue; foreach (WayPoint wPoint in WayPointList) { if (!wpl.Contains (wPoint)) { if (Vector3.Distance (wPoint.Position, position) <= distance) { wp = wPoint; distance = Vector3.Distance (wPoint.Position, position); } } } return wp; }
internal void AddWay(WayPoint point) { //中継必要? if (pos.x != point.pos.x && pos.z != point.pos.z) { var midPoint = new WayPoint (); // 「型か 」型か if(Random.Range(0,2) == 0){ midPoint.pos.x = pos.x; midPoint.pos.z = point.pos.z; }else{ midPoint.pos.x = point.pos.x; midPoint.pos.z = pos.z; } AddWay (midPoint); midPoint.AddWay (point); return; } else { link.Add (point); point.link.Add (this); } }
// Collision triggers for waypoints and world events public void OnTriggerEnter(Collider trigger) { // Debug.Log ("I'm so triggered!"); // Solved a bug with NPCs triggering each other and getting confused. This would've lead to weird pathing if (trigger.gameObject.tag != "NPC") { // Get the current position based on the waypoint we just hit currentWaypoint = trigger.gameObject.GetComponent <WayPoint> (); // If the waypoint isn't a trap, world event, or the finish line if (currentWaypoint.wpType != WaypointType.Trap && currentWaypoint.wpType != WaypointType.WorldEvent && currentWaypoint.wpType != WaypointType.Finish) { if (currentWaypoint.visitedBy [ident - 1] != true) { currWpNum++; nextWaypoint = waypointList [currWpNum + 1]; currentWaypoint.visitedBy [ident - 1] = true; // House waypoint if (currentWaypoint.wpType == WaypointType.House) { waypointList [currWpNum - 1].visitedBy [ident - 1] = false; nextWaypoint = waypointList [currWpNum - 1]; currWpNum--; currentWaypoint.visitedBy [ident - 1] = true; gameController.AtHouse (ident); if (!isNaked) candyCounter += currentWaypoint.candyAmount; } SetTarget (); } } else if (currentWaypoint.wpType == WaypointType.Trap) { // Debug.Log ("Trap!"); // If the waypoint is a trap gameController.AtTrap(currentWaypoint.TrapTime ()); candyCounter += currentWaypoint.candyAmount; if (currentWaypoint.MakeNude()) { ToggleNude (); } } else if (currentWaypoint.wpType == WaypointType.Finish) { FinishLine (); } } }
public void Undock() { if (dockingTarget == null || !docked) { return; } #if CLIENT PlaySound(ActionType.OnUse, item.WorldPosition); #endif dockingTarget.item.Submarine.DockedTo.Remove(item.Submarine); item.Submarine.DockedTo.Remove(dockingTarget.item.Submarine); if (door != null && dockingTarget.door != null) { WayPoint myWayPoint = WayPoint.WayPointList.Find(wp => door.LinkedGap == wp.ConnectedGap); WayPoint targetWayPoint = WayPoint.WayPointList.Find(wp => dockingTarget.door.LinkedGap == wp.ConnectedGap); if (myWayPoint != null && targetWayPoint != null) { myWayPoint.linkedTo.Remove(targetWayPoint); targetWayPoint.linkedTo.Remove(myWayPoint); } } item.linkedTo.Clear(); docked = false; dockingTarget.Undock(); dockingTarget = null; if (doorBody != null) { GameMain.World.RemoveBody(doorBody); doorBody = null; } var wire = item.GetComponent <Wire>(); if (wire != null) { wire.Drop(null); } if (joint != null) { GameMain.World.RemoveJoint(joint); joint = null; } hulls[0]?.Remove(); hulls[0] = null; hulls[1]?.Remove(); hulls[1] = null; if (gap != null) { gap.Remove(); gap = null; } if (bodies != null) { foreach (Body body in bodies) { if (body == null) { continue; } GameMain.World.RemoveBody(body); } bodies = null; } if (GameMain.Server != null) { item.CreateServerEvent(this); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 6: { m_MobilesSeekHome = reader.ReadBool(); m_UsesSpawnerHome = reader.ReadBool(); goto case 5; } case 5: { m_SpawnArea = reader.ReadRect2D(); m_UsesSpawnerHome = reader.ReadBool(); goto case 4; } case 4: { m_WalkingRange = reader.ReadInt(); goto case 3; } case 3: case 2: { m_WayPoint = reader.ReadItem() as WayPoint; goto case 1; } case 1: { m_Group = reader.ReadBool(); goto case 0; } case 0: { m_MinDelay = reader.ReadTimeSpan(); m_MaxDelay = reader.ReadTimeSpan(); m_Count = reader.ReadInt(); m_Team = reader.ReadInt(); m_HomeRange = reader.ReadInt(); m_Running = reader.ReadBool(); TimeSpan ts = TimeSpan.Zero; if (m_Running) { ts = reader.ReadDeltaTime() - DateTime.UtcNow; } int size = reader.ReadInt(); m_SpawnNames = new List <string>(size); for (int i = 0; i < size; ++i) { string creatureString = reader.ReadString(); m_SpawnNames.Add(creatureString); string typeName = ParseType(creatureString); if (ScriptCompiler.FindTypeByName(typeName) == null) { if (m_WarnTimer == null) { m_WarnTimer = new WarnTimer(); } m_WarnTimer.Add(Location, Map, typeName); } } int count = reader.ReadInt(); m_Spawned = new List <ISpawnable>(count); for (int i = 0; i < count; ++i) { ISpawnable e = World.FindEntity(reader.ReadInt()) as ISpawnable; if (e != null) { e.Spawner = this; m_Spawned.Add(e); } } if (m_Running) { DoTimer(ts); } break; } } if (version < 3 && Weight == 0) { Weight = -1; } }
public Ferry(WayPoint wayPoint = null) { this.wayPoint = wayPoint; position = new WayPoint(); Direction = Direction.East; }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 0: { from.CloseGump(typeof(StartStopMaginciatram)); from.SendGump(new CityInvasion(from)); break; } case 1: { Point3D loc = new Point3D(568, 1311, 0); WayPoint point = new WayPoint(); WayPoint point1 = new WayPoint(); WayPoint point2 = new WayPoint(); WayPoint point3 = new WayPoint(); WayPoint point4 = new WayPoint(); WayPoint point5 = new WayPoint(); WayPoint point6 = new WayPoint(); WayPoint point7 = new WayPoint(); WayPoint point8 = new WayPoint(); WayPoint point9 = new WayPoint(); WayPoint point10 = new WayPoint(); WayPoint point11 = new WayPoint(); /*WayPoint point12 = new WayPoint(); * WayPoint point13 = new WayPoint(); * WayPoint point14 = new WayPoint(); * WayPoint point15 = new WayPoint(); * WayPoint point16 = new WayPoint(); * WayPoint point17 = new WayPoint(); * WayPoint point18 = new WayPoint(); * WayPoint point19 = new WayPoint(); * * WayPoint point20 = new WayPoint(); * WayPoint point21 = new WayPoint(); * WayPoint point22 = new WayPoint(); * WayPoint point23 = new WayPoint(); * WayPoint point24 = new WayPoint(); * WayPoint point25 = new WayPoint(); * WayPoint point26 = new WayPoint(); * WayPoint point27 = new WayPoint(); * WayPoint point28 = new WayPoint(); * WayPoint point29 = new WayPoint(); * * WayPoint point30 = new WayPoint(); * WayPoint point31 = new WayPoint(); * WayPoint point32 = new WayPoint(); * WayPoint point33 = new WayPoint(); * WayPoint point34 = new WayPoint(); * WayPoint point35 = new WayPoint(); * WayPoint point36 = new WayPoint(); * WayPoint point37 = new WayPoint(); * WayPoint point38 = new WayPoint(); * WayPoint point39 = new WayPoint(); * * WayPoint point40 = new WayPoint(); * WayPoint point41 = new WayPoint(); * WayPoint point42 = new WayPoint(); * WayPoint point43 = new WayPoint(); * WayPoint point44 = new WayPoint(); * WayPoint point45 = new WayPoint(); * WayPoint point46 = new WayPoint(); * WayPoint point47 = new WayPoint(); * WayPoint point48 = new WayPoint(); * WayPoint point49 = new WayPoint(); * * WayPoint point50 = new WayPoint(); * WayPoint point51 = new WayPoint(); * WayPoint point52 = new WayPoint(); * WayPoint point53 = new WayPoint(); * WayPoint point54 = new WayPoint(); * WayPoint point55 = new WayPoint(); * WayPoint point56 = new WayPoint(); * WayPoint point57 = new WayPoint(); * WayPoint point58 = new WayPoint(); * WayPoint point59 = new WayPoint(); * * WayPoint point60 = new WayPoint(); * WayPoint point61 = new WayPoint(); * WayPoint point62 = new WayPoint(); * WayPoint point63 = new WayPoint(); * WayPoint point64 = new WayPoint(); * WayPoint point65 = new WayPoint(); * WayPoint point66 = new WayPoint(); * WayPoint point67 = new WayPoint(); * WayPoint point68 = new WayPoint(); * WayPoint point69 = new WayPoint(); * * WayPoint point70 = new WayPoint(); * WayPoint point71 = new WayPoint(); * WayPoint point72 = new WayPoint(); * WayPoint point73 = new WayPoint(); * WayPoint point74 = new WayPoint(); * WayPoint point75 = new WayPoint(); * WayPoint point76 = new WayPoint(); * WayPoint point77 = new WayPoint(); * WayPoint point78 = new WayPoint(); * WayPoint point79 = new WayPoint(); * WayPoint point80 = new WayPoint(); * WayPoint point81 = new WayPoint(); * * WayPoint point82 = new WayPoint(); * WayPoint point83 = new WayPoint(); * WayPoint point84 = new WayPoint(); * WayPoint point85 = new WayPoint(); * WayPoint point86 = new WayPoint(); * WayPoint point87 = new WayPoint(); * WayPoint point88 = new WayPoint(); * WayPoint point89 = new WayPoint(); * WayPoint point90 = new WayPoint(); * WayPoint point91 = new WayPoint(); * WayPoint point92 = new WayPoint(); * WayPoint point93 = new WayPoint(); * * WayPoint point94 = new WayPoint(); * WayPoint point95 = new WayPoint(); * WayPoint point96 = new WayPoint(); * WayPoint point97 = new WayPoint(); * WayPoint point98 = new WayPoint(); * WayPoint point99 = new WayPoint(); * WayPoint point100 = new WayPoint(); * WayPoint point101 = new WayPoint(); * WayPoint point102 = new WayPoint(); * WayPoint point103 = new WayPoint(); * WayPoint point104 = new WayPoint(); * WayPoint point105 = new WayPoint(); * * WayPoint point106 = new WayPoint(); * WayPoint point107 = new WayPoint(); * WayPoint point108 = new WayPoint(); * WayPoint point109 = new WayPoint(); * WayPoint point110 = new WayPoint(); * WayPoint point111 = new WayPoint(); * WayPoint point112 = new WayPoint(); * WayPoint point113 = new WayPoint(); * WayPoint point114 = new WayPoint(); * WayPoint point115 = new WayPoint(); * WayPoint point116 = new WayPoint(); * WayPoint point117 = new WayPoint(); * WayPoint point118 = new WayPoint(); * WayPoint point119 = new WayPoint(); * WayPoint point120 = new WayPoint();*/ point.Name = "MaginciaInvasionTrammel"; point1.Name = "MaginciaInvasionTrammel"; point2.Name = "MaginciaInvasionTrammel"; point3.Name = "MaginciaInvasionTrammel"; point4.Name = "MaginciaInvasionTrammel"; point5.Name = "MaginciaInvasionTrammel"; point6.Name = "MaginciaInvasionTrammel"; point7.Name = "MaginciaInvasionTrammel"; point8.Name = "MaginciaInvasionTrammel"; point9.Name = "MaginciaInvasionTrammel"; point10.Name = "MaginciaInvasionTrammel"; point11.Name = "MaginciaInvasionTrammel"; /*point12.Name = "MaginciaInvasionTrammel"; * point13.Name = "MaginciaInvasionTrammel"; * point14.Name = "MaginciaInvasionTrammel"; * point15.Name = "MaginciaInvasionTrammel"; * point16.Name = "MaginciaInvasionTrammel"; * point17.Name = "MaginciaInvasionTrammel"; * point18.Name = "MaginciaInvasionTrammel"; * point19.Name = "MaginciaInvasionTrammel"; * * point20.Name = "MaginciaInvasionTrammel"; * point21.Name = "MaginciaInvasionTrammel"; * point22.Name = "MaginciaInvasionTrammel"; * point23.Name = "MaginciaInvasionTrammel"; * point24.Name = "MaginciaInvasionTrammel"; * point25.Name = "MaginciaInvasionTrammel"; * point26.Name = "MaginciaInvasionTrammel"; * point27.Name = "MaginciaInvasionTrammel"; * point28.Name = "MaginciaInvasionTrammel"; * point29.Name = "MaginciaInvasionTrammel"; * * point30.Name = "MaginciaInvasionTrammel"; * point31.Name = "MaginciaInvasionTrammel"; * point32.Name = "MaginciaInvasionTrammel"; * point33.Name = "MaginciaInvasionTrammel"; * point34.Name = "MaginciaInvasionTrammel"; * point35.Name = "MaginciaInvasionTrammel"; * point36.Name = "MaginciaInvasionTrammel"; * point37.Name = "MaginciaInvasionTrammel"; * point38.Name = "MaginciaInvasionTrammel"; * point39.Name = "MaginciaInvasionTrammel"; * * point40.Name = "MaginciaInvasionTrammel"; * point41.Name = "MaginciaInvasionTrammel"; * point42.Name = "MaginciaInvasionTrammel"; * point43.Name = "MaginciaInvasionTrammel"; * point44.Name = "MaginciaInvasionTrammel"; * point45.Name = "MaginciaInvasionTrammel"; * point46.Name = "MaginciaInvasionTrammel"; * point47.Name = "MaginciaInvasionTrammel"; * point48.Name = "MaginciaInvasionTrammel"; * point49.Name = "MaginciaInvasionTrammel"; * * point50.Name = "MaginciaInvasionTrammel"; * point51.Name = "MaginciaInvasionTrammel"; * point52.Name = "MaginciaInvasionTrammel"; * point53.Name = "MaginciaInvasionTrammel"; * point54.Name = "MaginciaInvasionTrammel"; * point55.Name = "MaginciaInvasionTrammel"; * point56.Name = "MaginciaInvasionTrammel"; * point57.Name = "MaginciaInvasionTrammel"; * point58.Name = "MaginciaInvasionTrammel"; * point59.Name = "MaginciaInvasionTrammel"; * * point60.Name = "MaginciaInvasionTrammel"; * point61.Name = "MaginciaInvasionTrammel"; * point62.Name = "MaginciaInvasionTrammel"; * point63.Name = "MaginciaInvasionTrammel"; * point64.Name = "MaginciaInvasionTrammel"; * point65.Name = "MaginciaInvasionTrammel"; * point66.Name = "MaginciaInvasionTrammel"; * point67.Name = "MaginciaInvasionTrammel"; * point68.Name = "MaginciaInvasionTrammel"; * point69.Name = "MaginciaInvasionTrammel"; * * point70.Name = "MaginciaInvasionTrammel"; * point71.Name = "MaginciaInvasionTrammel"; * point72.Name = "MaginciaInvasionTrammel"; * point73.Name = "MaginciaInvasionTrammel"; * point74.Name = "MaginciaInvasionTrammel"; * point75.Name = "MaginciaInvasionTrammel"; * point76.Name = "MaginciaInvasionTrammel"; * point77.Name = "MaginciaInvasionTrammel"; * point78.Name = "MaginciaInvasionTrammel"; * point79.Name = "MaginciaInvasionTrammel"; * point80.Name = "MaginciaInvasionTrammel"; * point81.Name = "MaginciaInvasionTrammel"; * * point82.Name = "MaginciaInvasionTrammel"; * point83.Name = "MaginciaInvasionTrammel"; * point84.Name = "MaginciaInvasionTrammel"; * point85.Name = "MaginciaInvasionTrammel"; * point86.Name = "MaginciaInvasionTrammel"; * point87.Name = "MaginciaInvasionTrammel"; * point88.Name = "MaginciaInvasionTrammel"; * point89.Name = "MaginciaInvasionTrammel"; * point90.Name = "MaginciaInvasionTrammel"; * point91.Name = "MaginciaInvasionTrammel"; * point92.Name = "MaginciaInvasionTrammel"; * point93.Name = "MaginciaInvasionTrammel"; * * point94.Name = "MaginciaInvasionTrammel"; * point95.Name = "MaginciaInvasionTrammel"; * point96.Name = "MaginciaInvasionTrammel"; * point97.Name = "MaginciaInvasionTrammel"; * point98.Name = "MaginciaInvasionTrammel"; * point99.Name = "MaginciaInvasionTrammel"; * point100.Name = "MaginciaInvasionTrammel"; * point101.Name = "MaginciaInvasionTrammel"; * point102.Name = "MaginciaInvasionTrammel"; * point103.Name = "MaginciaInvasionTrammel"; * point104.Name = "MaginciaInvasionTrammel"; * point105.Name = "MaginciaInvasionTrammel"; * * point106.Name = "MaginciaInvasionTrammel"; * point107.Name = "MaginciaInvasionTrammel"; * point108.Name = "MaginciaInvasionTrammel"; * point109.Name = "MaginciaInvasionTrammel"; * point110.Name = "MaginciaInvasionTrammel"; * point111.Name = "MaginciaInvasionTrammel"; * point112.Name = "MaginciaInvasionTrammel"; * point113.Name = "MaginciaInvasionTrammel"; * point114.Name = "MaginciaInvasionTrammel"; * point115.Name = "MaginciaInvasionTrammel"; * point116.Name = "MaginciaInvasionTrammel"; * point117.Name = "MaginciaInvasionTrammel"; * point118.Name = "MaginciaInvasionTrammel"; * point119.Name = "MaginciaInvasionTrammel"; * point120.Name = "MaginciaInvasionTrammel";*/ GuardedRegion reg = from.Region as GuardedRegion; if (reg == null) { from.SendMessage(33, "You are not in the guarded part of Magincia, Trammel."); from.SendMessage(33, "You will have to go there and use [toggleguarded to turn the guards off."); } else if (reg.Disabled) { from.SendMessage(3, "The guards in this region have not changed."); } else if (!reg.Disabled) { reg.Disabled = !reg.Disabled; from.SendMessage(3, "The guards in this region have been disabled."); } if (DummyMessage && reg != null) { from.SendMessage(33, "If you are not in the guarded part of Magincia, Trammel."); from.SendMessage(33, "You will have to go there and use [toggleguarded to turn the guards off."); } Spawner spawner1 = new Spawner(4, 5, 15, 0, 10, "OrcBomber"); spawner1.MoveToWorld(new Point3D(3654, 2070, 20), Map.Trammel); spawner1.WayPoint = point; point.MoveToWorld(new Point3D(3708, 2090, 5), Map.Trammel); point.NextPoint = point1; point1.MoveToWorld(new Point3D(3707, 2180, 20), Map.Trammel); point1.NextPoint = point2; point2.MoveToWorld(new Point3D(3675, 2180, 20), Map.Trammel); point2.NextPoint = point3; point3.MoveToWorld(new Point3D(3675, 2235, 20), Map.Trammel); point3.NextPoint = point4; point4.MoveToWorld(new Point3D(3741, 2235, 20), Map.Trammel); point4.NextPoint = point5; point5.MoveToWorld(new Point3D(3741, 2188, 20), Map.Trammel); point5.NextPoint = point6; point6.MoveToWorld(new Point3D(3707, 2188, 20), Map.Trammel); point6.NextPoint = point7; point7.MoveToWorld(new Point3D(3707, 2180, 20), Map.Trammel); point7.NextPoint = point8; point8.MoveToWorld(new Point3D(3675, 2180, 20), Map.Trammel); point8.NextPoint = point9; point9.MoveToWorld(new Point3D(3675, 2115, 20), Map.Trammel); point9.NextPoint = point10; point10.MoveToWorld(new Point3D(3754, 2115, 20), Map.Trammel); point10.NextPoint = point11; point11.MoveToWorld(new Point3D(3708, 2115, 20), Map.Trammel); point11.NextPoint = point; spawner1.Name = "MaginciaInvasionTrammel"; spawner1.Respawn(); /*Spawner spawner2 = new Spawner( 4, 5, 15, 0, 15, "Orc" ); * spawner2.MoveToWorld( new Point3D( 2694, 466, 18 ), Map.Trammel ); * spawner2.WayPoint = point12; * point12.MoveToWorld( new Point3D( 2662, 469, 15 ), Map.Trammel ); * point12.NextPoint = point13; * point13.MoveToWorld( new Point3D( 2625, 469, 15 ), Map.Trammel ); * point13.NextPoint = point14; * point14.MoveToWorld( new Point3D( 2613, 507, 15 ), Map.Trammel ); * point14.NextPoint = point15; * point15.MoveToWorld( new Point3D( 2558, 513, 15 ), Map.Trammel ); * point15.NextPoint = point16; * point16.MoveToWorld( new Point3D( 2558, 496, 0 ), Map.Trammel ); * point16.NextPoint = point17; * point17.MoveToWorld( new Point3D( 2576, 479, 0 ), Map.Trammel ); * point17.NextPoint = point18; * point18.MoveToWorld( new Point3D( 2558, 496, 0 ), Map.Trammel ); * point18.NextPoint = point19; * point19.MoveToWorld( new Point3D( 2558, 528, 15 ), Map.Trammel ); * point19.NextPoint = point20; * point20.MoveToWorld( new Point3D( 2569, 537, 15 ), Map.Trammel ); * point20.NextPoint = point21; * point21.MoveToWorld( new Point3D( 2599, 531, 15 ), Map.Trammel ); * point21.NextPoint = point22; * point22.MoveToWorld( new Point3D( 2599, 504, 0 ), Map.Trammel ); * point22.NextPoint = point23; * point23.MoveToWorld( new Point3D( 2606, 502, 0 ), Map.Trammel ); * point23.NextPoint = point24; * point24.MoveToWorld( new Point3D( 2604, 496, 20 ), Map.Trammel ); * point24.NextPoint = point25; * point25.MoveToWorld( new Point3D( 2578, 500, 22 ), Map.Trammel ); * point25.NextPoint = point26; * point26.MoveToWorld( new Point3D( 2582, 493, 40 ), Map.Trammel ); * point26.NextPoint = point27; * point27.MoveToWorld( new Point3D( 2609, 469, 40 ), Map.Trammel ); * point27.NextPoint = point28; * point28.MoveToWorld( new Point3D( 2602, 466, 60 ), Map.Trammel ); * point28.NextPoint = point29; * point29.MoveToWorld( new Point3D( 2604, 453, 60 ), Map.Trammel ); * point29.NextPoint = point30; * point30.MoveToWorld( new Point3D( 2591, 457, 60 ), Map.Trammel ); * point30.NextPoint = point31; * point31.MoveToWorld( new Point3D( 2604, 453, 60 ), Map.Trammel ); * point31.NextPoint = point32; * point32.MoveToWorld( new Point3D( 2602, 466, 60 ), Map.Trammel ); * point32.NextPoint = point33; * point33.MoveToWorld( new Point3D( 2609, 469, 40 ), Map.Trammel ); * point33.NextPoint = point34; * point34.MoveToWorld( new Point3D( 2582, 493, 40 ), Map.Trammel ); * point34.NextPoint = point35; * point35.MoveToWorld( new Point3D( 2578, 500, 22 ), Map.Trammel ); * point35.NextPoint = point36; * point36.MoveToWorld( new Point3D( 2604, 496, 20 ), Map.Trammel ); * point36.NextPoint = point37; * point37.MoveToWorld( new Point3D( 2606, 502, 0 ), Map.Trammel ); * point37.NextPoint = point14; * spawner2.Name = "MaginciaInvasionTrammel"; * spawner2.Respawn(); * * Spawner spawner3 = new Spawner( 6, 5, 15, 0, 10, "Orc" ); * spawner3.MoveToWorld( new Point3D( 2555, 370, 15 ), Map.Trammel ); * spawner3.WayPoint = point38; * point38.MoveToWorld( new Point3D( 2532, 389, 15 ), Map.Trammel ); * point38.NextPoint = point39; * point39.MoveToWorld( new Point3D( 2510, 386, 15 ), Map.Trammel ); * point39.NextPoint = point40; * point40.MoveToWorld( new Point3D( 2500, 419, 15 ), Map.Trammel ); * point40.NextPoint = point41; * point41.MoveToWorld( new Point3D( 2445, 419, 15 ), Map.Trammel ); * point41.NextPoint = point42; * point42.MoveToWorld( new Point3D( 2445, 447, 15 ), Map.Trammel ); * point42.NextPoint = point43; * point43.MoveToWorld( new Point3D( 2501, 444, 15 ), Map.Trammel ); * point43.NextPoint = point44; * point44.MoveToWorld( new Point3D( 2501, 485, 15 ), Map.Trammel ); * point44.NextPoint = point45; * point45.MoveToWorld( new Point3D( 2469, 483, 15 ), Map.Trammel ); * point45.NextPoint = point46; * point46.MoveToWorld( new Point3D( 2469, 461, 15 ), Map.Trammel ); * point46.NextPoint = point47; * point47.MoveToWorld( new Point3D( 2476, 461, 15 ), Map.Trammel ); * point47.NextPoint = point48; * point48.MoveToWorld( new Point3D( 2476, 435, 15 ), Map.Trammel ); * point48.NextPoint = point49; * point49.MoveToWorld( new Point3D( 2467, 435, 15 ), Map.Trammel ); * point49.NextPoint = point50; * point50.MoveToWorld( new Point3D( 2467, 418, 15 ), Map.Trammel ); * point50.NextPoint = point51; * point51.MoveToWorld( new Point3D( 2500, 419, 15 ), Map.Trammel ); * point51.NextPoint = point39; * spawner3.Name = "MaginciaInvasionTrammel"; * spawner3.Respawn(); * * Spawner spawner4 = new Spawner( 4, 5, 15, 0, 50, "Orc" ); * spawner4.MoveToWorld( new Point3D( 2598, 747, 0 ), Map.Trammel ); * spawner4.WayPoint = point52; * point52.MoveToWorld( new Point3D( 2579, 690, 0 ), Map.Trammel ); * point52.NextPoint = point53; * point53.MoveToWorld( new Point3D( 2561, 623, 0 ), Map.Trammel ); * point53.NextPoint = point54; * point54.MoveToWorld( new Point3D( 2513, 620, 0 ), Map.Trammel ); * point54.NextPoint = point55; * point55.MoveToWorld( new Point3D( 2517, 562, 0 ), Map.Trammel ); * point55.NextPoint = point56; * point56.MoveToWorld( new Point3D( 2486, 564, 5 ), Map.Trammel ); * point56.NextPoint = point57; * point57.MoveToWorld( new Point3D( 2486, 544, 0 ), Map.Trammel ); * point57.NextPoint = point58; * point58.MoveToWorld( new Point3D( 2465, 543, 0 ), Map.Trammel ); * point58.NextPoint = point59; * point59.MoveToWorld( new Point3D( 2465, 528, 15 ), Map.Trammel ); * point59.NextPoint = point60; * point60.MoveToWorld( new Point3D( 2455, 528, 15 ), Map.Trammel ); * point60.NextPoint = point61; * point61.MoveToWorld( new Point3D( 2455, 513, 15 ), Map.Trammel ); * point61.NextPoint = point62; * point62.MoveToWorld( new Point3D( 2475, 513, 15 ), Map.Trammel ); * point62.NextPoint = point63; * point63.MoveToWorld( new Point3D( 2475, 528, 15 ), Map.Trammel ); * point63.NextPoint = point60; * spawner4.Name = "MaginciaInvasionTrammel"; * spawner4.Respawn(); * * Spawner spawner5 = new Spawner( 6, 5, 15, 0, 4, "Orc" ); * spawner5.MoveToWorld( new Point3D( 2579, 376, 5 ), Map.Trammel ); * spawner5.WayPoint = point65; * point64.MoveToWorld( new Point3D( 2579, 398, 15 ), Map.Trammel ); * point64.NextPoint = point65; * point65.MoveToWorld( new Point3D( 2623, 437, 15 ), Map.Trammel ); * point65.NextPoint = point66; * point66.MoveToWorld( new Point3D( 2617, 506, 15 ), Map.Trammel ); * point66.NextPoint = point67; * point67.MoveToWorld( new Point3D( 2562, 513, 15 ), Map.Trammel ); * point67.NextPoint = point68; * point68.MoveToWorld( new Point3D( 2551, 501, 15 ), Map.Trammel ); * point68.NextPoint = point69; * point69.MoveToWorld( new Point3D( 2525, 501, 15 ), Map.Trammel ); * point69.NextPoint = point70; * point70.MoveToWorld( new Point3D( 2525, 516, 0 ), Map.Trammel ); * point70.NextPoint = point71; * point71.MoveToWorld( new Point3D( 2489, 516, 0 ), Map.Trammel ); * point71.NextPoint = point72; * point72.MoveToWorld( new Point3D( 2489, 482, 15 ), Map.Trammel ); * point72.NextPoint = point73; * point73.MoveToWorld( new Point3D( 2500, 484, 15 ), Map.Trammel ); * point73.NextPoint = point74; * point74.MoveToWorld( new Point3D( 2500, 442, 15 ), Map.Trammel ); * point74.NextPoint = point75; * point75.MoveToWorld( new Point3D( 2514, 442, 15 ), Map.Trammel ); * point75.NextPoint = point76; * point76.MoveToWorld( new Point3D( 2514, 419, 15 ), Map.Trammel ); * point76.NextPoint = point77; * point77.MoveToWorld( new Point3D( 2445, 419, 15 ), Map.Trammel ); * point77.NextPoint = point78; * point78.MoveToWorld( new Point3D( 2444, 444, 15 ), Map.Trammel ); * point78.NextPoint = point79; * point79.MoveToWorld( new Point3D( 2531, 444, 15 ), Map.Trammel ); * point79.NextPoint = point69; * spawner5.Name = "MaginciaInvasionTrammel"; * spawner5.Respawn(); * * Spawner spawner6 = new Spawner( 1, 5, 15, 0, 0, "OrcishLord" ); * spawner6.MoveToWorld( new Point3D( 2420, 420, 15 ), Map.Trammel ); * spawner6.WayPoint = point80; * point80.MoveToWorld( new Point3D( 2489, 419, 15 ), Map.Trammel ); * point80.NextPoint = point81; * point81.MoveToWorld( new Point3D( 2491, 442, 15 ), Map.Trammel ); * point81.NextPoint = point82; * point82.MoveToWorld( new Point3D( 2476, 442, 15 ), Map.Trammel ); * point82.NextPoint = point83; * point83.MoveToWorld( new Point3D( 2475, 460, 15 ), Map.Trammel ); * point83.NextPoint = point84; * point84.MoveToWorld( new Point3D( 2467, 460, 15 ), Map.Trammel ); * point84.NextPoint = point85; * point85.MoveToWorld( new Point3D( 2469, 481, 15 ), Map.Trammel ); * point85.NextPoint = point86; * point86.MoveToWorld( new Point3D( 2491, 481, 15 ), Map.Trammel ); * point86.NextPoint = point87; * point87.MoveToWorld( new Point3D( 2488, 564, 5 ), Map.Trammel ); * point87.NextPoint = point88; * point88.MoveToWorld( new Point3D( 2514, 561, 0 ), Map.Trammel ); * point88.NextPoint = point89; * point89.MoveToWorld( new Point3D( 2516, 529, 0 ), Map.Trammel ); * point89.NextPoint = point90; * point90.MoveToWorld( new Point3D( 2489, 529, 0 ), Map.Trammel ); * point90.NextPoint = point91; * point91.MoveToWorld( new Point3D( 2489, 493, 15 ), Map.Trammel ); * point91.NextPoint = point92; * point92.MoveToWorld( new Point3D( 2504, 482, 15 ), Map.Trammel ); * point92.NextPoint = point80; * spawner6.Name = "MaginciaInvasionTrammel"; * spawner6.Respawn(); * * Spawner spawner7 = new Spawner( 1, 5, 15, 0, 0, "OrcCaptain" ); * spawner7.MoveToWorld( new Point3D( 1351, 1757, 17 ), Map.Trammel ); * spawner7.WayPoint = point93; * point93.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point93.NextPoint = point94; * point94.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point94.NextPoint = point95; * point95.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point95.NextPoint = point96; * point96.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point96.NextPoint = point97; * point97.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point97.NextPoint = point98; * point98.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point98.NextPoint = point99; * point99.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point99.NextPoint = point100; * point100.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point100.NextPoint = point101; * point101.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point101.NextPoint = point102; * point102.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point102.NextPoint = point103; * spawner7.Name = "MaginciaInvasionTrammel"; * spawner7.Respawn(); * * Spawner spawner8 = new Spawner( 1, 10, 20, 0, 10, "OrcBrute" ); * spawner8.MoveToWorld( new Point3D( 1370, 1749, 3 ), Map.Trammel ); * spawner8.WayPoint = point103; * point103.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point103.NextPoint = point104; * point104.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point104.NextPoint = point105; * point105.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point105.NextPoint = point106; * point106.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point106.NextPoint = point107; * point107.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point107.NextPoint = point108; * point108.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point108.NextPoint = point109; * point109.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point109.NextPoint = point110; * point110.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point110.NextPoint = point111; * point111.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point111.NextPoint = point112; * point112.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point112.NextPoint = point113; * point113.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point113.NextPoint = point114; * point114.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point114.NextPoint = point115; * point115.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point125.NextPoint = point116; * point116.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point116.NextPoint = point117; * point117.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point117.NextPoint = point118; * point118.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point118.NextPoint = point119; * point119.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point119.NextPoint = point120; * point120.MoveToWorld( new Point3D( 2491, 419, 15 ), Map.Trammel ); * point120.NextPoint = point103; * spawner8.Name = "MaginciaInvasionTrammel"; * spawner8.Respawn();*/ World.Broadcast(33, true, "Magincia Trammel is under invasion."); from.SendGump(new CityInvasion(from)); break; } case 2: { GuardedRegion reg = from.Region as GuardedRegion; if (reg == null) { from.SendMessage(33, "You are not in a The guarded part of Magincia, Trammel."); from.SendMessage(33, "You will have to go there and use [toggleguarded to turn the guards on."); } else if (!reg.Disabled) { from.SendMessage(3, "The guards in THIS region have not changed."); } else if (reg.Disabled) { reg.Disabled = !reg.Disabled; from.SendMessage(3, "The guards in THIS region have been enabled."); } if (DummyMessage && reg != null) { from.SendMessage(33, "If you are not in a The guarded part of Magincia, Trammel."); from.SendMessage(33, "You will have to go there and use [toggleguarded to turn the guards on."); } MaginciaInvasionStone maginciatram = new MaginciaInvasionStone(); maginciatram.StopMaginciaTrammel(); World.Broadcast(33, true, "Magincia Trammel's invasion was successfully beaten back. No more invaders are left in the city."); from.SendGump(new CityInvasion(from)); break; } } }
public void Undock() { if (DockingTarget == null || !docked) { return; } forceLockTimer = 0.0f; ApplyStatusEffects(ActionType.OnSecondaryUse, 1.0f); DockingTarget.item.Submarine.DockedTo.Remove(item.Submarine); item.Submarine.DockedTo.Remove(DockingTarget.item.Submarine); if (door != null && DockingTarget.door != null) { WayPoint myWayPoint = WayPoint.WayPointList.Find(wp => door.LinkedGap == wp.ConnectedGap); WayPoint targetWayPoint = WayPoint.WayPointList.Find(wp => DockingTarget.door.LinkedGap == wp.ConnectedGap); if (myWayPoint != null && targetWayPoint != null) { myWayPoint.linkedTo.Remove(targetWayPoint); targetWayPoint.linkedTo.Remove(myWayPoint); } } item.linkedTo.Clear(); docked = false; DockingTarget.Undock(); DockingTarget = null; if (doorBody != null) { GameMain.World.RemoveBody(doorBody); doorBody = null; } var wire = item.GetComponent <Wire>(); if (wire != null) { wire.Drop(null); } if (joint != null) { GameMain.World.RemoveJoint(joint); joint = null; } hulls[0]?.Remove(); hulls[0] = null; hulls[1]?.Remove(); hulls[1] = null; if (gap != null) { gap.Remove(); gap = null; } if (bodies != null) { foreach (Body body in bodies) { if (body == null) { continue; } GameMain.World.RemoveBody(body); } bodies = null; } Item.Submarine.EnableObstructedWaypoints(); obstructedWayPointsDisabled = false; #if SERVER if (GameMain.Server != null) { item.CreateServerEvent(this); } #endif }
public WayPointViewModel(IEnumerable <ServiceModel> services, IEnumerable <WayPoint> links, WayPoint wayPoint = null) { if (wayPoint == null) { wayPoint = new WayPoint(0, 0, 0, 5, 5); } _services = services; _links = links.Where(wp => wp.LayerId != wayPoint.LayerId); _wayPoint = wayPoint; _x = wayPoint.X; _y = wayPoint.Y; _width = wayPoint.Width; _height = wayPoint.Height; _name = wayPoint.Name; _isInput = wayPoint.IsInput; _isOutput = wayPoint.IsOutput; _isService = wayPoint.IsServicePoint; if (_isService) { SelectedService = services.FirstOrDefault(s => s.Id == wayPoint.ServiceId); } _isLinked = wayPoint.IsLinked; if (_isLinked) { SelectedLink = wayPoint.LinkedPoint; } }
void DrawWayPoint(WayPoint wp, Color c, string label = null, float r = IconSize, Texture2D texture = null) { if(DrawGroundMarker(vessel.mainBody, wp, c, r, texture)) DrawLabelAtPointer(label ?? wp.SurfaceDescription(vessel), wp.DistanceTo(vessel)); }
public void Lock(bool isNetworkMessage, bool forcePosition = false) { #if CLIENT if (GameMain.Client != null && !isNetworkMessage) { return; } #endif if (DockingTarget == null) { DebugConsole.ThrowError("Error - attempted to lock a docking port that's not connected to anything"); return; } if (!(joint is WeldJoint)) { DockingDir = GetDir(DockingTarget); DockingTarget.DockingDir = -DockingDir; ApplyStatusEffects(ActionType.OnUse, 1.0f); Vector2 jointDiff = joint.WorldAnchorB - joint.WorldAnchorA; if (item.Submarine.PhysicsBody.Mass < DockingTarget.item.Submarine.PhysicsBody.Mass || DockingTarget.item.Submarine.Info.IsOutpost) { item.Submarine.SubBody.SetPosition(item.Submarine.SubBody.Position + ConvertUnits.ToDisplayUnits(jointDiff)); } else if (DockingTarget.item.Submarine.PhysicsBody.Mass < item.Submarine.PhysicsBody.Mass || item.Submarine.Info.IsOutpost) { DockingTarget.item.Submarine.SubBody.SetPosition(DockingTarget.item.Submarine.SubBody.Position - ConvertUnits.ToDisplayUnits(jointDiff)); } ConnectWireBetweenPorts(); CreateJoint(true); #if SERVER if (GameMain.Server != null && (!item.Submarine?.Loading ?? true)) { originalDockingTargetID = DockingTarget.item.ID; item.CreateServerEvent(this); } #else if (GameMain.Client != null && GameMain.Client.MidRoundSyncing && (item.Submarine == Submarine.MainSub || DockingTarget.item.Submarine == Submarine.MainSub)) { Screen.Selected.Cam.Position = Submarine.MainSub.WorldPosition; } #endif } List <MapEntity> removedEntities = item.linkedTo.Where(e => e.Removed).ToList(); foreach (MapEntity removed in removedEntities) { item.linkedTo.Remove(removed); } if (!item.linkedTo.Any(e => e is Hull) && !DockingTarget.item.linkedTo.Any(e => e is Hull)) { CreateHulls(); } if (Door != null && DockingTarget.Door != null) { WayPoint myWayPoint = WayPoint.WayPointList.Find(wp => Door.LinkedGap == wp.ConnectedGap); WayPoint targetWayPoint = WayPoint.WayPointList.Find(wp => DockingTarget.Door.LinkedGap == wp.ConnectedGap); if (myWayPoint != null && targetWayPoint != null) { myWayPoint.FindHull(); myWayPoint.linkedTo.Add(targetWayPoint); targetWayPoint.FindHull(); targetWayPoint.linkedTo.Add(myWayPoint); } } }
public void WaypointOverlay() { if(TCA == null || !TCA.Available || !TCAGui.HUD_enabled) return; if(SelectingTarget) { var coords = MapView.MapIsEnabled? Coordinates.GetAtPointer(vessel.mainBody) : Coordinates.GetAtPointerInFlight(); if(coords != null) { var t = new WayPoint(coords); DrawGroundMarker(vessel.mainBody, coords, new Color(1.0f, 0.56f, 0.0f)); DrawLabelAtPointer(coords.FullDescription(vessel), t.DistanceTo(vessel)); if(!clicked) { if(Input.GetMouseButtonDown(0)) clicked = true; else if(Input.GetMouseButtonDown(1)) { clicked_time = DateTime.Now; clicked = true; } } else { if(Input.GetMouseButtonUp(0)) { if(select_single) { SelectingTarget = false; select_single = false; VSL.SetTarget(t); MapView.ExitMapView(); } else AddTargetDamper.Run(() => CFG.Waypoints.Enqueue(t)); CFG.ShowWaypoints = true; clicked = false; } if(Input.GetMouseButtonUp(1)) { SelectingTarget &= (DateTime.Now - clicked_time).TotalSeconds >= GLB.ClickDuration; clicked = false; } } } } bool current_target_drawn = false; if(CFG.ShowWaypoints) { var i = 0; var num = (float)(CFG.Waypoints.Count-1); WayPoint wp0 = null; foreach(var wp in CFG.Waypoints) { current_target_drawn |= wp.Equals(CFG.Target); wp.UpdateCoordinates(vessel.mainBody); var c = marker_color(i, num); if(wp0 == null) DrawPath(vessel, wp, c); else DrawPath(vessel.mainBody, wp0, wp, c); if(DrawGroundMarker(vessel.mainBody, wp, c)) DrawLabelAtPointer(wp.SurfaceDescription(vessel), wp.DistanceTo(vessel)); wp0 = wp; i++; } } //current target and anchor if(CFG.Anchor != null) { DrawWayPoint(CFG.Anchor, Color.cyan, "Anchor"); current_target_drawn |= CFG.Anchor.Equals(CFG.Target); } if(CFG.Target != null && !current_target_drawn && (!CFG.Target.IsVessel || CFG.Target.GetVessel().LandedOrSplashed)) DrawWayPoint(CFG.Target, Color.magenta, "Target"); //custom markers VSL.Info.CustomMarkersWP.ForEach(m => DrawWayPoint(m, Color.red, m.Name)); VSL.Info.CustomMarkersVec.ForEach(m => DrawWorldMarker(m, Color.red, "Custom WayPoint")); #if DEBUG // VSL.Engines.All.ForEach(e => e.engine.thrustTransforms.ForEach(t => DrawWorldMarker(t.position, Color.red, e.name))); // DrawWorldMarker(VSL.vessel.transform.position, Color.yellow, "Vessel"); // DrawWorldMarker(VSL.Physics.wCoM, Color.green, "CoM"); #endif }
static void DrawPath(CelestialBody body, WayPoint wp0, WayPoint wp1, Color c) { var D = wp1.AngleTo(wp0); var N = (int)Mathf.Clamp((float)D*Mathf.Rad2Deg, 2, 5); var dD = D/N; for(int i = 1; i<N; i++) { var p = wp0.PointBetween(wp1, dD*i); DrawGroundMarker(body, p, c, IconSize/2, PathNodeMarker); } }
void SetTrigger(WayPoint wp, bool value) { wp.GetComponent <Collider>().isTrigger = value; wp.GetComponent <Renderer>().material = value ? activeState : normalState; }
public void AssignWayPoint(NPC npc, WayPoint wayPoint) { npc.wayPoint = wayPoint; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: case 1: if (version == 1 || reader.ReadInt() == 0) { Level3Spawner = new Level3Spawner(reader, this); } goto case 0; case 0: if (version == 0) { Level3Spawner = new Level3Spawner(this); Timer.DelayCall(() => { ResetLevel3Spawners(); }); } RespawnMin = reader.ReadInt(); RespawnMax = reader.ReadInt(); WaypointsA = new List <WayPoint>(); WaypointsB = new List <WayPoint>(); Active = reader.ReadBool(); NextStart = DateTime.UtcNow; int counta = reader.ReadInt(); int countb = reader.ReadInt(); for (int i = 0; i < counta; i++) { WayPoint wp = reader.ReadItem() as WayPoint; if (wp != null) { WaypointsA.Add(wp); } } for (int i = 0; i < countb; i++) { WayPoint wp = reader.ReadItem() as WayPoint; if (wp != null) { WaypointsB.Add(wp); } } break; } if (Map == Map.Felucca) { InstanceFel = this; } else { InstanceTram = this; } Timer.DelayCall(TimeSpan.FromSeconds(10), () => { ClearSpawn(); ClearSpawners(); }); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: { m_WayPoint = reader.ReadItem() as WayPoint; goto case 1; } case 1: { m_Group = reader.ReadBool(); goto case 0; } case 0: { m_MinDelay = reader.ReadTimeSpan(); m_MaxDelay = reader.ReadTimeSpan(); m_Count = reader.ReadInt(); m_Team = reader.ReadInt(); m_HomeRange = reader.ReadInt(); m_Running = reader.ReadBool(); TimeSpan ts = TimeSpan.Zero; if (m_Running) { ts = reader.ReadDeltaTime() - DateTime.Now; } int size = reader.ReadInt(); m_CreaturesName = new ArrayList(size); for (int i = 0; i < size; ++i) { string typeName = reader.ReadString(); m_CreaturesName.Add(typeName); if (SpawnerType.GetType(typeName) == null) { if (m_WarnTimer == null) { m_WarnTimer = new WarnTimer(); } m_WarnTimer.Add(Location, Map, typeName); } } int count = reader.ReadInt(); m_Creatures = new ArrayList(count); for (int i = 0; i < count; ++i) { IEntity e = World.Instance.FindEntity(reader.ReadInt()); if (e != null) { m_Creatures.Add(e); } } if (m_Running) { DoTimer(ts); } break; } } }
/// <summary> /// Поиск пути к целевой путевой точке по клеткам, используя алгоритм A* /// </summary> /// <param name="position">Текущая позиция</param> /// <param name="layerId">Идентификатор слоя</param> /// <param name="targetWayPoint">Целевая путевая точка</param> /// <returns>Последовательность клеток</returns> public List<Point> GetWay(Point position, WayPoint targetWayPoint) { var target = GetCloasureEmptyPoint(position, targetWayPoint); if (ReferenceEquals(target, Point.Empty)) { return null; } return this.GetWay(position, target); }
public static void AddWaypoints() { var one = VoidPoolController.InstanceTram; var two = VoidPoolController.InstanceFel; if (one == null || two == null) { return; } foreach (var w in one.WaypointsA.Where(w => w != null && !w.Deleted)) { w.Delete(); } foreach (var w in one.WaypointsB.Where(w => w != null && !w.Deleted)) { w.Delete(); } foreach (var w in two.WaypointsA.Where(w => w != null && !w.Deleted)) { w.Delete(); } foreach (var w in two.WaypointsB.Where(w => w != null && !w.Deleted)) { w.Delete(); } // patha var wp = new WayPoint(); wp.MoveToWorld(new Point3D(5590, 2024, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5590, 2024, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5578, 2029, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5578, 2029, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5566, 2027, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5566, 2027, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5555, 2021, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5555, 2021, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); wp.MoveToWorld(new Point3D(5545, 2015, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5545, 2015, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5537, 2020, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5537, 2020, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5527, 2015, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5527, 2015, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5509, 2005, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5509, 2005, 0), Map.Felucca); two.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5500, 1998, 0), Map.Trammel); one.WaypointsA.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5500, 1998, 0), Map.Felucca); two.WaypointsA.Add(wp); // pathb wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5469, 2016, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5469, 2016, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5478, 2025, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5478, 2025, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5484, 2029, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5484, 2029, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5490, 2027, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5490, 2027, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5504, 2027, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5504, 2027, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5516, 2020, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5516, 2020, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5524, 2012, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5524, 2012, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5513, 2005, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5513, 2005, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5502, 2004, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5502, 2004, 0), Map.Felucca); two.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5500, 1998, 0), Map.Trammel); one.WaypointsB.Add(wp); wp = new WayPoint(); WeakEntityCollection.Add("newcovetous", wp); wp.MoveToWorld(new Point3D(5500, 1998, 0), Map.Felucca); two.WaypointsB.Add(wp); for (int i = 0; i < one.WaypointsA.Count; i++) { WayPoint waypoint = one.WaypointsA[i]; if (i < one.WaypointsA.Count - 1) { waypoint.NextPoint = one.WaypointsA[i + 1]; } } for (int i = 0; i < one.WaypointsB.Count; i++) { WayPoint waypoint = one.WaypointsB[i]; if (i < one.WaypointsB.Count - 1) { waypoint.NextPoint = one.WaypointsB[i + 1]; } } for (int i = 0; i < two.WaypointsA.Count; i++) { WayPoint waypoint = two.WaypointsA[i]; if (i < two.WaypointsA.Count - 1) { waypoint.NextPoint = two.WaypointsA[i + 1]; } } for (int i = 0; i < two.WaypointsB.Count; i++) { WayPoint waypoint = two.WaypointsB[i]; if (i < two.WaypointsB.Count - 1) { waypoint.NextPoint = two.WaypointsB[i + 1]; } } one.WaypointACount = one.WaypointsA.Count; one.WaypointBCount = one.WaypointsB.Count; two.WaypointACount = two.WaypointsA.Count; two.WaypointBCount = two.WaypointsB.Count; }
public WayPointF(WayPoint wp) { this.wp = wp; InitializeComponent(); }
public void Dock(DockingPort target) { if (item.Submarine.DockedTo.Contains(target.item.Submarine)) { return; } forceLockTimer = 0.0f; if (DockingTarget != null) { Undock(); } if (target.item.Submarine == item.Submarine) { DebugConsole.ThrowError("Error - tried to dock a submarine to itself"); DockingTarget = null; return; } target.InitializeLinks(); if (!item.linkedTo.Contains(target.item)) { item.linkedTo.Add(target.item); } if (!target.item.linkedTo.Contains(item)) { target.item.linkedTo.Add(item); } if (!target.item.Submarine.DockedTo.Contains(item.Submarine)) { target.item.Submarine.DockedTo.Add(item.Submarine); } if (!item.Submarine.DockedTo.Contains(target.item.Submarine)) { item.Submarine.DockedTo.Add(target.item.Submarine); } DockingTarget = target; DockingTarget.DockingTarget = this; docked = true; DockingTarget.Docked = true; if (Character.Controlled != null && (Character.Controlled.Submarine == DockingTarget.item.Submarine || Character.Controlled.Submarine == item.Submarine)) { GameMain.GameScreen.Cam.Shake = Vector2.Distance(DockingTarget.item.Submarine.Velocity, item.Submarine.Velocity); } DockingDir = IsHorizontal ? Math.Sign(DockingTarget.item.WorldPosition.X - item.WorldPosition.X) : Math.Sign(DockingTarget.item.WorldPosition.Y - item.WorldPosition.Y); DockingTarget.DockingDir = -DockingDir; if (door != null && DockingTarget.door != null) { WayPoint myWayPoint = WayPoint.WayPointList.Find(wp => door.LinkedGap == wp.ConnectedGap); WayPoint targetWayPoint = WayPoint.WayPointList.Find(wp => DockingTarget.door.LinkedGap == wp.ConnectedGap); if (myWayPoint != null && targetWayPoint != null) { myWayPoint.linkedTo.Add(targetWayPoint); targetWayPoint.linkedTo.Add(myWayPoint); } } CreateJoint(false); #if SERVER if (GameMain.Server != null) { item.CreateServerEvent(this); } #endif }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 0: { from.CloseGump(typeof(StartStopUmbraMalas)); from.SendGump(new CityInvasion(from)); break; } case 1: { Point3D loc = new Point3D(568, 1311, 0); WayPoint point = new WayPoint(); WayPoint point1 = new WayPoint(); WayPoint point2 = new WayPoint(); //WayPoint point3 = new WayPoint(); point.Name = "UmbraInvasionMalas"; point1.Name = "UmbraInvasionMalas"; point2.Name = "UmbraInvasionMalas"; Spawner spawner1 = new Spawner(1, 1440, 1441, 0, 6, "OrcBrute"); spawner1.MoveToWorld(new Point3D(950, 284, -90), Map.Malas); spawner1.WayPoint = point; point.MoveToWorld(new Point3D(950, 265, -90), Map.Malas); point.NextPoint = point2; point2.MoveToWorld(new Point3D(950, 275, -90), Map.Malas); spawner1.Name = "UmbraInvasionMalas"; spawner1.Respawn(); Spawner spawner2 = new Spawner(1, 1440, 1441, 0, 6, "OrcBomber"); spawner2.MoveToWorld(new Point3D(952, 284, -90), Map.Malas); spawner2.WayPoint = point1; point1.MoveToWorld(new Point3D(952, 265, -90), Map.Malas); spawner2.Name = "UmbraInvasionMalas"; spawner2.Respawn(); Spawner spawner3 = new Spawner(1, 1440, 1441, 0, 6, "Savage"); spawner3.MoveToWorld(new Point3D(950, 244, -90), Map.Malas); spawner3.WayPoint = point; spawner3.Name = "UmbraInvasionMalas"; spawner3.Respawn(); Spawner spawner4 = new Spawner(1, 1440, 1441, 0, 6, "SavageRider"); spawner4.MoveToWorld(new Point3D(952, 244, -90), Map.Malas); spawner4.WayPoint = point1; spawner4.Name = "UmbraInvasionMalas"; spawner4.Respawn(); World.Broadcast(33, true, "Umbra Malas is under invasion."); from.SendGump(new CityInvasion(from)); break; } case 2: { UmbraInvasionStone umbmal = new UmbraInvasionStone(); umbmal.StopUmbraMalas(); World.Broadcast(33, true, "Umbra Malas's invasion was successfully beaten back. No more invaders are left in the city."); from.SendGump(new CityInvasion(from)); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 6: { m_Flags = (SpawnFlag)reader.ReadInt(); if (Group) { TimeSpan delay = reader.ReadDateTime() - DateTime.Now; if (delay.TotalMilliseconds < 0) { delay = TimeSpan.Zero; } m_GroupRespawnTimer = Timer.DelayCall(delay, GroupRespawn); } goto case 5; } case 5: { if (version < 6) { Murderer = reader.ReadBool(); } goto case 4; } case 4: { if (version < 6) { Blessed = reader.ReadBool(); } goto case 3; } case 3: { if (version < 6) { ScaledDelay = reader.ReadBool(); reader.ReadBool(); // despawned reader.ReadBool(); // player range sensitive } goto case 2; } case 2: { if (version < 6) { CantWalk = reader.ReadBool(); } goto case 1; } case 1: { m_WayPoint = reader.ReadItem() as WayPoint; if (version < 6) { Group = reader.ReadBool(); } m_MinDelay = reader.ReadTimeSpan(); m_MaxDelay = reader.ReadTimeSpan(); m_Count = reader.ReadInt(); // old count m_Team = reader.ReadInt(); m_SpawnRange = reader.ReadInt(); m_HomeRange = reader.ReadInt(); m_Active = reader.ReadBool(); m_SpawnType = ValidateType(reader.ReadString()); int instanceCount = 0; if (version >= 3) { instanceCount = reader.ReadInt(); } m_Instances = new List <SpawnInstance>(); for (int i = 0; i < instanceCount; ++i) { SpawnInstance instance = new SpawnInstance(reader, this); m_Instances.Add(instance); } break; } } }
private void Awake() { wayPoint = GetComponent <WayPoint>(); }
// Use this for initialization protected override void Awake() { base.Awake(); way = GetComponent <WayPoint>(); }
private void Move() { Route _route = on_main_route ? route : temp; if (current_WP < 0 || current_WP >= _route.Count) { throw new System.ArgumentOutOfRangeException(current_WP.ToString()); } //WayPoint toGo = current; //Vector3 WPpos = toGo.Position + v_height; WayPoint toGo = _route[current_WP]; if (toGo == null) { Debug.Log("<color=red>toGo is null</color>"); return; } Vector3 WPpos = toGo.Position + v_height; Position = Vector3.MoveTowards(this.Position, WPpos, Time.deltaTime * MoveSpeed); //var rotation = Quaternion.LookRotation(toGo.Position - this.Position); var rotation = Quaternion.LookRotation(toGo.Position - this.Position); rotation.eulerAngles = new Vector3(0, rotation.eulerAngles.y + 90f, 0); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * RotateSpeed); sphere.transform.position = (Position + 4 * transform.right); if (Vector3.Distance(WPpos, this.Position) <= 0.6f) { current_WP++; if (!on_main_route && current_WP >= temp.Count) { current = temp.endWP; //if (route.Contains(curr)) { } on_main_route = true; RouteSet.RemoveRoute(temp); temp.HighLight(false); temp = null; current_WP = route.IndexOf(current); //sphereCurr.SetPosition(current.Position); } if (current_WP < _route.Count) { current = _route[current_WP]; sphereCurr.SetPosition(current.Position); } if (current_WP > route.Count / 2) { route_forward = false; } } if (current_WP >= route.Count) { if (!on_main_route) { Abort("Did not reach main route"); } route_forward = true; current_WP = 0; current = route.startWP; sphereCurr.SetPosition(current.Position); } }
void UpdatePath(uint diff) { if (!HasEscortState(SmartEscortState.Escorting)) return; if (mEscortInvokerCheckTimer < diff) { // Escort failed, no players in range if (!IsEscortInvokerInRange()) { StopPath(0, mEscortQuestID, true); // allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying GetScript().ProcessEventsFor(SmartEvents.Death, me); me.DespawnOrUnsummon(1); return; } mEscortInvokerCheckTimer = 1000; } else mEscortInvokerCheckTimer -= diff; // handle pause if (HasEscortState(SmartEscortState.Paused)) { if (mWPPauseTimer < diff) { if (!me.IsInCombat() && !HasEscortState(SmartEscortState.Returning) && (mWPReached || mLastWPIDReached == EventId.SmartEscortLastOCCPoint || mForcedPaused)) { GetScript().ProcessEventsFor(SmartEvents.WaypointResumed, null, mLastWP.Id, GetScript().GetPathId()); RemoveEscortState(SmartEscortState.Paused); if (mForcedPaused)// if paused between 2 wps resend movement { ResumePath(); mWPReached = false; mForcedPaused = false; } if (mLastWPIDReached == EventId.SmartEscortLastOCCPoint) mWPReached = true; } mWPPauseTimer = 0; } else mWPPauseTimer -= diff; } if (HasEscortState(SmartEscortState.Returning)) { if (mWPReached)//reached OOC WP { RemoveEscortState(SmartEscortState.Returning); if (!HasEscortState(SmartEscortState.Paused)) ResumePath(); mWPReached = false; } } if ((!me.HasReactState(ReactStates.Passive) && me.IsInCombat()) || HasEscortState(SmartEscortState.Paused | SmartEscortState.Returning)) return; // handle next wp if (mWPReached)//reached WP { mWPReached = false; if (mCurrentWPID == GetWPCount()) { EndPath(); } else { WayPoint wp = GetNextWayPoint(); if (wp != null) { SetRun(mRun); me.GetMotionMaster().MovePoint(wp.Id, wp.X, wp.Y, wp.Z); } } } }
// Update is called once per frame void Update() { if (NextWaypoint != null && LastWaypoint != null) { // car rotation Vector3 targetPoint = NextWaypoint.transform.position + line; var lookPos = targetPoint - transform.position; Quaternion rotation = new Quaternion(); if (lookPos != Vector3.zero) { rotation = Quaternion.LookRotation(lookPos); } transform.rotation = Quaternion.RotateTowards(transform.rotation, rotation, rotationTime * Time.deltaTime); float rotY = transform.rotation.eulerAngles.y; if (rotY > 315 || rotY <= 45) { line = new Vector3(linesize, 0, 0); } else if (rotY > 45 && rotY <= 135) { line = new Vector3(0, 0, -linesize); } else if (rotY > 135 && rotY <= 225) { line = new Vector3(-linesize, 0, 0); } else if (rotY > 225 && rotY <= 315) { line = new Vector3(0, 0, linesize); } transform.position = Vector3.MoveTowards(transform.position, NextWaypoint.transform.position + line, speed * Time.deltaTime); //setting current line if (transform.position == NextWaypoint.transform.position + line) { List <WayPoint> waypoints = NextWaypoint.getWaypointsAround(); if (waypoints.Count == 1) { if (jump == false && canJump) { transform.position = NextWaypoint.transform.position + -line; jump = true; } transform.eulerAngles = new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y - 10, transform.rotation.eulerAngles.z); LastWaypoint = NextWaypoint; NextWaypoint = waypoints[0]; } else if (waypoints.Count >= 2 && waypoints.Count <= 4) { waypoints.Remove(LastWaypoint); LastWaypoint = NextWaypoint; NextWaypoint = waypoints[Random.Range(0, waypoints.Count)]; jump = false; } else { } /* * CarWayPoint c = NextWaypoint; * var result = NextWaypoint.getNextWaypoint(LastWaypoint); * NextWaypoint = result.Item1; * LastWaypoint = c; */ } } }
} // end of FromGame() /// <summary> /// Hand off copies the objects in this XmlLevelData object /// into AddThing. /// </summary> /// <param name="gameThingList"></param> public void ToGame(InGame.AddThingDelegate AddThing) { WayPoint.ClearPaths(); GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; // Copy local data to sim classes. // Copy waypoint data to sim classes. // In with the new. for (int i = 0; i < waypoints.paths.Count; i++) { XmlData.Path p = (XmlData.Path)waypoints.paths[i]; WayPoint.Path path = new WayPoint.Path(p.color); path.RoadName = p.roadName; // Create nodes. for (int j = 0; j < p.nodes.Count; j++) { XmlData.Node n = (XmlData.Node)p.nodes[j]; WayPoint.Node node = new WayPoint.Node(path, new Vector3(n.position, n.height)); } // Create edges. for (int j = 0; j < p.edges.Count; j++) { XmlData.Edge e = (XmlData.Edge)p.edges[j]; WayPoint.Node n0 = (WayPoint.Node)path.Nodes[e.node0]; WayPoint.Node n1 = (WayPoint.Node)path.Nodes[e.node1]; WayPoint.CreateNewEdge(n0, n1, (WayPoint.Edge.Direction)e.direction); } path.RecalcHeights(onLoad: true); if (path.Road != null) { path.Road.Build(); } } for (int i = 0; i < actor.Count; ++i) { XmlData.Actor srcActor = (XmlData.Actor)actor[i]; GameActor dstActor = ActorFromString(srcActor.typename); if (dstActor != null) { srcActor.ToActor(dstActor); dstActor = (GameActor)AddThing(dstActor); if (dstActor != null) { // Init InsideGlassWalls. // TODO (****) Right now we're doing this by checking the height of the terrain. // We should also be able to do this by checking the material index BUT it appears // that when we erase terrain we only set the height to 0 without resetting the material. // I think... dstActor.Chassis.InsideGlassWalls = Terrain.GetTerrainAndPathHeight(dstActor.Movement.Position) > 0; } } } } // end of ToGame()
public void RespawnCharacters() { var server = networkMember as GameServer; if (server == null) { return; } var respawnSub = respawnShuttle != null ? respawnShuttle : Submarine.MainSub; var clients = GetClientsToRespawn(); foreach (Client c in clients) { //all characters are in Team 1 in game modes/missions with only one team. //if at some point we add a game mode with multiple teams where respawning is possible, this needs to be reworked c.TeamID = 1; if (c.CharacterInfo == null) { c.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, c.Name); } } List <CharacterInfo> characterInfos = clients.Select(c => c.CharacterInfo).ToList(); if (server.Character != null && server.Character.IsDead) { characterInfos.Add(server.CharacterInfo); } server.AssignJobs(clients, server.Character != null && server.Character.IsDead); foreach (Client c in clients) { c.CharacterInfo.Job = new Job(c.AssignedJob); } //the spawnpoints where the characters will spawn var shuttleSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnSub); //the spawnpoints where they would spawn if they were spawned inside the main sub //(in order to give them appropriate ID card tags) var mainSubSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); ItemPrefab divingSuitPrefab = MapEntityPrefab.Find("Diving Suit") as ItemPrefab; ItemPrefab oxyPrefab = MapEntityPrefab.Find("Oxygen Tank") as ItemPrefab; ItemPrefab scooterPrefab = MapEntityPrefab.Find("Underwater Scooter") as ItemPrefab; ItemPrefab batteryPrefab = MapEntityPrefab.Find("Battery Cell") as ItemPrefab; var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnSub && wp.SpawnType == SpawnType.Cargo); for (int i = 0; i < characterInfos.Count; i++) { bool myCharacter = false; #if CLIENT myCharacter = i >= clients.Count; #endif var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false); character.TeamID = 1; #if CLIENT if (myCharacter) { server.Character = character; Character.Controlled = character; GameMain.LightManager.LosEnabled = true; GameServer.Log(string.Format("Respawning {0} (host) as {1}", character.Name, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } else { #endif clients[i].Character = character; GameServer.Log(string.Format("Respawning {0} ({1}) as {2}", clients[i].Name, clients[i].Connection?.RemoteEndPoint?.Address, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); #if CLIENT } #endif Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; if (divingSuitPrefab != null && oxyPrefab != null) { var divingSuit = new Item(divingSuitPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(divingSuit, false); respawnItems.Add(divingSuit); var oxyTank = new Item(oxyPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(oxyTank, false); divingSuit.Combine(oxyTank); respawnItems.Add(oxyTank); } if (scooterPrefab != null && batteryPrefab != null) { var scooter = new Item(scooterPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(scooter, false); var battery = new Item(batteryPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(battery, false); scooter.Combine(battery); respawnItems.Add(scooter); respawnItems.Add(battery); } //give the character the items they would've gotten if they had spawned in the main sub character.GiveJobItems(mainSubSpawnPoints[i]); //add the ID card tags they should've gotten when spawning in the shuttle foreach (Item item in character.Inventory.Items) { if (item == null || item.Prefab.Name != "ID Card") { continue; } foreach (string s in shuttleSpawnPoints[i].IdCardTags) { item.AddTag(s); } if (!string.IsNullOrWhiteSpace(shuttleSpawnPoints[i].IdCardDesc)) { item.Description = shuttleSpawnPoints[i].IdCardDesc; } } #if CLIENT GameMain.GameSession.CrewManager.AddCharacter(character); #endif } }
public async Task LoadData() { Reader reader = files_array[SMem.Data].reader; if (exportTextures) { string state = loadingState; loadingState = "Exporting textures"; await WaitIfNecessary(); ExportTextures(reader); loadingState = state; await WaitIfNecessary(); return; } // Load current level data loadingState = "Loading level data"; await WaitIfNecessary(); LevelHeader lh = GetOrRead <LevelHeader>(reader, (ushort)(CurrentLevel | (ushort)FATEntry.Flag.Fix)); level = lh; loadingState = "Loading additional object lists"; await WaitIfNecessary(); for (ushort i = 0; i < 0x7FFF; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading additional object lists: " + (i + 1); await WaitIfNecessary(); } ObjectsTable ot = GetOrRead <ObjectsTable>(reader, (ushort)(i | (ushort)FATEntry.Flag.Fix)); if (ot != null) { objectsTables.Add(ot); } } for (ushort i = 0; i < 0x8000; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading additional object lists: " + (i + 1); await WaitIfNecessary(); } ObjectsTable ot = GetOrRead <ObjectsTable>(reader, i); if (ot != null) { objectsTables.Add(ot); } } for (ushort i = 0; i < 0x7FFF; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading waypoints: " + (i + 1); await WaitIfNecessary(); } WayPoint wp = GetOrRead <WayPoint>(reader, (ushort)(i | (ushort)FATEntry.Flag.Fix)); } for (ushort i = 0; i < 0x8000; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading waypoints: " + (i + 1); await WaitIfNecessary(); } WayPoint wp = GetOrRead <WayPoint>(reader, i); } for (ushort i = 0; i < 0x7FFF; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading graphs: " + (i + 1); await WaitIfNecessary(); } Graph g = GetOrRead <Graph>(reader, (ushort)(i | (ushort)FATEntry.Flag.Fix)); } for (ushort i = 0; i < 0x8000; i++) { // Only do it a few times because we're trying to load way more than there is, // so it takes really long if we yield for everything if (i % 4096 == 0) { loadingState = "Loading graphs: " + (i + 1); await WaitIfNecessary(); } Graph g = GetOrRead <Graph>(reader, i); } loadingState = "Initializing hierarchy"; await WaitIfNecessary(); if (lh != null) { if (lh.hierarchyRoot.Value != null) { lh.hierarchyRoot.Value.GetGameObject(); } } }
partial void RespawnCharactersProjSpecific(Vector2?shuttlePos) { var respawnSub = RespawnShuttle ?? Submarine.MainSub; MultiPlayerCampaign campaign = GameMain.GameSession.GameMode as MultiPlayerCampaign; var clients = GetClientsToRespawn().ToList(); foreach (Client c in clients) { //get rid of the existing character c.Character?.DespawnNow(); c.WaitForNextRoundRespawn = null; var matchingData = campaign?.GetClientCharacterData(c); if (matchingData != null && !matchingData.HasSpawned) { c.CharacterInfo = matchingData.CharacterInfo; } //all characters are in Team 1 in game modes/missions with only one team. //if at some point we add a game mode with multiple teams where respawning is possible, this needs to be reworked c.TeamID = CharacterTeamType.Team1; if (c.CharacterInfo == null) { c.CharacterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, c.Name); } } List <CharacterInfo> characterInfos = clients.Select(c => c.CharacterInfo).ToList(); //bots don't respawn in the campaign if (campaign == null) { var botsToSpawn = GetBotsToRespawn(); characterInfos.AddRange(botsToSpawn); } GameMain.Server.AssignJobs(clients); foreach (Client c in clients) { if (campaign?.GetClientCharacterData(c) == null || c.CharacterInfo.Job == null) { c.CharacterInfo.Job = new Job(c.AssignedJob.First, c.AssignedJob.Second); } } //the spawnpoints where the characters will spawn var shuttleSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnSub); //the spawnpoints where they would spawn if they were spawned inside the main sub //(in order to give them appropriate ID card tags) var mainSubSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); ItemPrefab divingSuitPrefab = null; if ((shuttlePos != null && Level.Loaded.GetRealWorldDepth(shuttlePos.Value.Y) > Level.DefaultRealWorldCrushDepth) || Level.Loaded.GetRealWorldDepth(Submarine.MainSub.WorldPosition.Y) > Level.DefaultRealWorldCrushDepth) { divingSuitPrefab = ItemPrefab.Prefabs.FirstOrDefault(it => it.Tags.Any(t => t.Equals("respawnsuitdeep", StringComparison.OrdinalIgnoreCase))); } if (divingSuitPrefab == null) { divingSuitPrefab = ItemPrefab.Prefabs.FirstOrDefault(it => it.Tags.Any(t => t.Equals("respawnsuit", StringComparison.OrdinalIgnoreCase))) ?? ItemPrefab.Find(null, "divingsuit"); } ItemPrefab oxyPrefab = ItemPrefab.Find(null, "oxygentank"); ItemPrefab scooterPrefab = ItemPrefab.Find(null, "underwaterscooter"); ItemPrefab batteryPrefab = ItemPrefab.Find(null, "batterycell"); var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnSub && wp.SpawnType == SpawnType.Cargo); for (int i = 0; i < characterInfos.Count; i++) { bool bot = i >= clients.Count; characterInfos[i].ClearCurrentOrders(); var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, characterInfos[i].Name, isRemotePlayer: !bot, hasAi: bot); character.TeamID = CharacterTeamType.Team1; if (bot) { GameServer.Log(string.Format("Respawning bot {0} as {1}", character.Info.Name, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } else { //tell the respawning client they're no longer a traitor if (GameMain.Server.TraitorManager?.Traitors != null && clients[i].Character != null) { if (GameMain.Server.TraitorManager.Traitors.Any(t => t.Character == clients[i].Character)) { GameMain.Server.SendDirectChatMessage(TextManager.FormatServerMessage("TraitorRespawnMessage"), clients[i], ChatMessageType.ServerMessageBox); } } clients[i].Character = character; character.OwnerClientEndPoint = clients[i].Connection.EndPointString; character.OwnerClientName = clients[i].Name; GameServer.Log(string.Format("Respawning {0} ({1}) as {2}", GameServer.ClientLogName(clients[i]), clients[i].Connection?.EndPointString, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } if (divingSuitPrefab != null && oxyPrefab != null && RespawnShuttle != null) { Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; if (divingSuitPrefab != null && oxyPrefab != null) { var divingSuit = new Item(divingSuitPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(divingSuit, false); respawnItems.Add(divingSuit); var oxyTank = new Item(oxyPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(oxyTank, false); divingSuit.Combine(oxyTank, user: null); respawnItems.Add(oxyTank); } if (scooterPrefab != null && batteryPrefab != null) { var scooter = new Item(scooterPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(scooter, false); var battery = new Item(batteryPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(battery, false); scooter.Combine(battery, user: null); respawnItems.Add(scooter); respawnItems.Add(battery); } } var characterData = campaign?.GetClientCharacterData(clients[i]); if (characterData != null && Level.Loaded?.Type != LevelData.LevelType.Outpost && characterData.HasSpawned) { var respawnPenaltyAffliction = AfflictionPrefab.List.FirstOrDefault(a => a.AfflictionType.Equals("respawnpenalty", StringComparison.OrdinalIgnoreCase)); if (respawnPenaltyAffliction != null) { character.CharacterHealth.ApplyAffliction(targetLimb: null, respawnPenaltyAffliction.Instantiate(10.0f)); } } if (characterData == null || characterData.HasSpawned) { //give the character the items they would've gotten if they had spawned in the main sub character.GiveJobItems(mainSubSpawnPoints[i]); if (campaign != null) { characterData = campaign.SetClientCharacterData(clients[i]); characterData.HasSpawned = true; } } else { characterData.SpawnInventoryItems(character, character.Inventory); characterData.ApplyHealthData(character.Info, character); character.GiveIdCardTags(mainSubSpawnPoints[i]); characterData.HasSpawned = true; } //add the ID card tags they should've gotten when spawning in the shuttle foreach (Item item in character.Inventory.AllItems.Distinct()) { if (item.Prefab.Identifier != "idcard") { continue; } foreach (string s in shuttleSpawnPoints[i].IdCardTags) { item.AddTag(s); } if (!string.IsNullOrWhiteSpace(shuttleSpawnPoints[i].IdCardDesc)) { item.Description = shuttleSpawnPoints[i].IdCardDesc; } } } }
public void Init(){ m_Instance = this; SetupWPNode (); }
partial void RespawnCharactersProjSpecific() { var respawnSub = RespawnShuttle ?? Submarine.MainSub; var clients = GetClientsToRespawn(); foreach (Client c in clients) { //all characters are in Team 1 in game modes/missions with only one team. //if at some point we add a game mode with multiple teams where respawning is possible, this needs to be reworked c.TeamID = Character.TeamType.Team1; if (c.CharacterInfo == null) { c.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, c.Name); } } List <CharacterInfo> characterInfos = clients.Select(c => c.CharacterInfo).ToList(); var botsToSpawn = GetBotsToRespawn(); characterInfos.AddRange(botsToSpawn); GameMain.Server.AssignJobs(clients); foreach (Client c in clients) { c.CharacterInfo.Job = new Job(c.AssignedJob); } //the spawnpoints where the characters will spawn var shuttleSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnSub); //the spawnpoints where they would spawn if they were spawned inside the main sub //(in order to give them appropriate ID card tags) var mainSubSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); ItemPrefab divingSuitPrefab = MapEntityPrefab.Find(null, "divingsuit") as ItemPrefab; ItemPrefab oxyPrefab = MapEntityPrefab.Find(null, "oxygentank") as ItemPrefab; ItemPrefab scooterPrefab = MapEntityPrefab.Find(null, "underwaterscooter") as ItemPrefab; ItemPrefab batteryPrefab = MapEntityPrefab.Find(null, "batterycell") as ItemPrefab; var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnSub && wp.SpawnType == SpawnType.Cargo); for (int i = 0; i < characterInfos.Count; i++) { bool bot = i >= clients.Count; var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, characterInfos[i].Name, !bot, bot); character.TeamID = Character.TeamType.Team1; if (bot) { GameServer.Log(string.Format("Respawning bot {0} as {1}", character.Info.Name, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } else { //tell the respawning client they're no longer a traitor if (GameMain.Server.TraitorManager != null && clients[i].Character != null) { if (GameMain.Server.TraitorManager.TraitorList.Any(t => t.Character == clients[i].Character)) { GameMain.Server.SendDirectChatMessage(TextManager.Get("traitorrespawnmessage"), clients[i], ChatMessageType.MessageBox); } } clients[i].Character = character; character.OwnerClientIP = clients[i].Connection.RemoteEndPoint.Address.ToString(); character.OwnerClientName = clients[i].Name; GameServer.Log(string.Format("Respawning {0} ({1}) as {2}", clients[i].Name, clients[i].Connection?.RemoteEndPoint?.Address, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } if (divingSuitPrefab != null && oxyPrefab != null && RespawnShuttle != null) { Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; if (divingSuitPrefab != null && oxyPrefab != null) { var divingSuit = new Item(divingSuitPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(divingSuit, false); respawnItems.Add(divingSuit); var oxyTank = new Item(oxyPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(oxyTank, false); divingSuit.Combine(oxyTank); respawnItems.Add(oxyTank); } if (scooterPrefab != null && batteryPrefab != null) { var scooter = new Item(scooterPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(scooter, false); var battery = new Item(batteryPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(battery, false); scooter.Combine(battery); respawnItems.Add(scooter); respawnItems.Add(battery); } } //give the character the items they would've gotten if they had spawned in the main sub character.GiveJobItems(mainSubSpawnPoints[i]); //add the ID card tags they should've gotten when spawning in the shuttle foreach (Item item in character.Inventory.Items) { if (item == null || item.Prefab.Identifier != "idcard") { continue; } foreach (string s in shuttleSpawnPoints[i].IdCardTags) { item.AddTag(s); } if (!string.IsNullOrWhiteSpace(shuttleSpawnPoints[i].IdCardDesc)) { item.Description = shuttleSpawnPoints[i].IdCardDesc; } } } }
static bool DrawGroundMarker(CelestialBody body, WayPoint wp, Color c, float r = IconSize, Texture2D texture = null) { return DrawGroundMarker(body, wp.Pos, c, r, texture); }
public override void Start() { base.Start(); var firstAidOrder = Order.GetPrefab("requestfirstaid"); doctor_firstAidIcon = firstAidOrder.SymbolSprite; doctor_firstAidIconColor = firstAidOrder.Color; subPatients = new List <Character>(); radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker"); doctor = Character.Controlled; var bandages = FindOrGiveItem(doctor, "antibleeding1"); bandages.Unequip(doctor); doctor.Inventory.RemoveItem(bandages); var syringegun = FindOrGiveItem(doctor, "syringegun"); syringegun.Unequip(doctor); doctor.Inventory.RemoveItem(syringegun); var antibiotics = FindOrGiveItem(doctor, "antibiotics"); antibiotics.Unequip(doctor); doctor.Inventory.RemoveItem(antibiotics); var morphine = FindOrGiveItem(doctor, "antidama1"); morphine.Unequip(doctor); doctor.Inventory.RemoveItem(morphine); doctor_suppliesCabinet = Item.ItemList.Find(i => i.HasTag("doctor_suppliescabinet"))?.GetComponent <ItemContainer>(); doctor_medBayCabinet = Item.ItemList.Find(i => i.HasTag("doctor_medbaycabinet"))?.GetComponent <ItemContainer>(); var patientHull1 = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "waitingroom").CurrentHull; var patientHull2 = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "airlock").CurrentHull; medBay = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "medbay").CurrentHull; var assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("assistant")); patient1 = Character.Create(assistantInfo, patientHull1.WorldPosition, "1"); patient1.GiveJobItems(null); patient1.CanSpeak = false; patient1.AddDamage(patient1.WorldPosition, new List <Affliction>() { new Affliction(AfflictionPrefab.Burn, 45.0f) }, stun: 0, playSound: false); patient1.AIController.Enabled = false; assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("assistant")); patient2 = Character.Create(assistantInfo, patientHull2.WorldPosition, "2"); patient2.GiveJobItems(null); patient2.CanSpeak = false; patient2.AIController.Enabled = false; var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer")); var subPatient1 = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "3"); subPatient1.AddDamage(patient1.WorldPosition, new List <Affliction>() { new Affliction(AfflictionPrefab.Burn, 40.0f) }, stun: 0, playSound: false); subPatients.Add(subPatient1); var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("securityofficer")); var subPatient2 = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "3"); subPatient2.AddDamage(patient1.WorldPosition, new List <Affliction>() { new Affliction(AfflictionPrefab.InternalDamage, 40.0f) }, stun: 0, playSound: false); subPatients.Add(subPatient2); var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer")); var subPatient3 = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "3"); subPatient3.AddDamage(patient1.WorldPosition, new List <Affliction>() { new Affliction(AfflictionPrefab.Burn, 20.0f) }, stun: 0, playSound: false); subPatients.Add(subPatient3); doctor_firstDoor = Item.ItemList.Find(i => i.HasTag("doctor_firstdoor")).GetComponent <Door>(); doctor_secondDoor = Item.ItemList.Find(i => i.HasTag("doctor_seconddoor")).GetComponent <Door>(); doctor_thirdDoor = Item.ItemList.Find(i => i.HasTag("doctor_thirddoor")).GetComponent <Door>(); tutorial_upperFinalDoor = Item.ItemList.Find(i => i.HasTag("tutorial_upperfinaldoor")).GetComponent <Door>(); doctor_firstDoorLight = Item.ItemList.Find(i => i.HasTag("doctor_firstdoorlight")).GetComponent <LightComponent>(); doctor_secondDoorLight = Item.ItemList.Find(i => i.HasTag("doctor_seconddoorlight")).GetComponent <LightComponent>(); doctor_thirdDoorLight = Item.ItemList.Find(i => i.HasTag("doctor_thirddoorlight")).GetComponent <LightComponent>(); SetDoorAccess(doctor_firstDoor, doctor_firstDoorLight, false); SetDoorAccess(doctor_secondDoor, doctor_secondDoorLight, false); SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, false); tutorial_submarineDoor = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>(); tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>(); SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false); tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>(); SetDoorAccess(tutorial_lockedDoor_2, null, true); foreach (var patient in subPatients) { patient.CanSpeak = false; patient.AIController.Enabled = false; patient.GiveJobItems(); } Item reactorItem = Item.ItemList.Find(i => i.Submarine == Submarine.MainSub && i.GetComponent <Reactor>() != null); reactorItem.GetComponent <Reactor>().AutoTemp = true; }
static void DrawPath(Vessel v, WayPoint wp1, Color c) { DrawPath(v.mainBody, new WayPoint(v.latitude, v.longitude), wp1, c); }
public bool Load(string path) { try { Filepath = path; Dirpath = Path.GetDirectoryName(path); if (!File.Exists(path)) { return(false); } string cnt = File.ReadAllText(path, Encoding.UTF8); if (string.IsNullOrEmpty(cnt)) { return(false); } JObject o = JObject.Parse(cnt); if (o["name"] != null) { Name = o["name"].ToString(); } if (o["version"] != null) { float v; Version = float.TryParse(o["version"].ToString(), out v) ? v : 1.0f; } if (o["targetHost"] != null) { TargetHost = o["targetHost"].ToString(); } if (o["targetPort"] != null) { UInt16 v; if (UInt16.TryParse(o["targetPort"].ToString(), out v)) { TargetPort = v; } else { TargetPort = 15471; } } if (o["designerColumns"] != null) { DesignerColumns = (int)o["designerColumns"]; } if (o["designerRows"] != null) { DesignerRows = (int)o["designerRows"]; } if (o["objects"] != null) { JArray ar = o["objects"] as JArray; if (ar != null) { foreach (var e in ar) { if (e == null) { continue; } if (string.IsNullOrEmpty(e.ToString())) { continue; } Objects.Add(e.ToString()); } } } if (o["track"] != null) { JObject ao = o["track"] as JObject; if (ao != null) { var item = new ProjectTrack(); if (item.Parse(ao)) { Track = item; } } } if (o["trackViews"] != null) { JArray ar = o["trackViews"] as JArray; if (ar != null) { for (int i = 0; i < ar.Count; ++i) { var obj = new ProjectTrackView(); if (obj.Parse(ar[i])) { TrackViews.Add(obj); } } } } if (o["routes"] != null || o["blockRoutes"] != null) { JArray ar = o["routes"] as JArray; if (ar == null) { ar = o["blockRoutes"] as JArray; } if (ar != null) { for (int i = 0; i < ar.Count; ++i) { var arr = ar[i] as JArray; if (arr == null) { continue; } Route route = new Route(); for (int j = 0; j < arr.Count; ++j) { WayPoint w = new WayPoint(); if (w.Parse(arr[j])) { route.Add(w); } } if (route.Count > 0) { BlockRoutes.Add(route); } } } if (BlockRoutes != null && BlockRoutes.Count > 0) { BlockRouteGroups = Map.GetRouteGroups(BlockRoutes); } } return(true); } catch (Exception ex) { Trace.WriteLine("<Project> " + ex.Message); return(false); } }
public Point GetCloasureEmptyPoint(Point position, WayPoint targetWayPoint) { return targetWayPoint.Center; //for (int i = 0; i < targetWayPoint.Width; i++) //{ // for (int j = 0; j < targetWayPoint.Height; j++) // { // int x = targetWayPoint.X + i; // int y = targetWayPoint.Y + i; // if (this.Cells[x, y].StaticValue > 0x00 && !this.Cells[x, y].HasAgent) // { // return new Point(x, y); // } // } //} //return Point.Empty; }
public override void Execute(CurrentPosition currentPosition, WayPoint wayPoint) { wayPoint.NorthSouth += Units; }
private void ConfigPoint(bool createNew = false) { var wnd = new View.ConfigWindows.DialogWindow(); wnd.Owner = Helpers.MVVM.MVVMHelper.GetActiveWindow(); wnd.Title = createNew ? "Создание точки" : "Редактирование точки"; var cont = new View.ConfigWindows.WayPointConfigPanel(); wnd.Content = cont; WayPointViewModel wpvm = null; if (createNew || _selectedIOPoint == null) { WayPoint wp = new WayPoint(0, 0, Layers.IndexOf(SelectedLayer), 5, 5); wpvm = new WayPointViewModel(_scenario.Services, AllWayPoints.Select(p => p.WayPoint), wp); wpvm.LayerId = Layers.IndexOf(_selectedLayer); } else { wpvm = _selectedIOPoint; wpvm.CloseView = false; } wnd.DataContext = wpvm; wnd.ShowDialog(); if (wpvm.DialogResult == true) { if (createNew) { AllWayPoints.Add(wpvm); OnPropertyChanged("IOPoints"); } } }
private void SetAsPath(WayPoint waypoint) { path.Add(waypoint); waypoint.isPlaceable = false; }