public static void SelectPlayer(string name, int avatar, int controllerId, int playerIndex) { //check commander doesnt already exist bool playerExists = false; for (int i = 0; i < Players.PeakCount; i++) { if (Players.arrayAllocation[i]) { PlayerDetails commander = Players[i]; if (commander.Name == name) { currentPlayer = commander; playerExists = true; } } } if (!playerExists) { PlayerDetails newPlayer = new PlayerDetails(name, avatar, controllerId, playerIndex); Players.Add(newPlayer); currentPlayer = newPlayer; Directory.CreateDirectory("SavedGames" + Path.DirectorySeparatorChar + name); } Save(); }
internal static int Assimilate(LSBody body, bool isDynamic) { if (CachedIDs.Count > 0) { id = CachedIDs.Pop(); } else { id = PeakCount; PeakCount++; if (PeakCount == SimObjects.Length) { //very very expensive Array.Resize(ref SimObjects, SimObjects.Length * 2); } } SimObjects[id] = body; //Important: If isDynamic is false, PhysicsManager won't check to update the item every frame. When the object is changed, it must be updated manually. if (isDynamic) { body.DynamicID = DynamicSimObjects.Add(body); } AssimilatedCount++; return(id); }
public static int AddNode(PartitionNode node) { int activationID = ActivatedNodes.Add(node); AllocatedNodes.Add(node); return(activationID); }
public void AddToSelection(RTSAgent agent) { if (agent.IsSelected == false) { SelectedAgents.Add(agent); SelectionChanged = true; } }
/// <summary> /// Starts coroutine that returns number of frames to wait. /// </summary> /// <returns>The coroutine.</returns> /// <param name="enumerator">Enumerator.</param> public static Coroutine StartCoroutine(IEnumerator <int> enumerator) { Coroutine coroutine = new Coroutine(); coroutine.Initialize(enumerator); coroutine.Index = Coroutines.Add(coroutine); return(coroutine); }
private void AddChild(LSBody child) { if (Children == null) { Children = new FastBucket <LSBody>(); } Children.Add(child); }
public static MovementGroup CreateGroup(Command com) { MovementGroup moveGroup = pooledGroups.Count > 0 ? pooledGroups.Pop() : new MovementGroup(); moveGroup.indexID = activeGroups.Add(moveGroup); LastCreatedGroup = moveGroup; moveGroup.Initialize(com); return(moveGroup); }
/// <summary> /// Non-deterministic /// </summary> /// <returns>The create and fire.</returns> /// <param name="curProj">Current proj.</param> /// <param name="projCode">Proj code.</param> /// <param name="position">Position.</param> /// <param name="direction">Direction.</param> /// <param name="gravity">If set to <c>true</c> gravity.</param> public static LSProjectile NDCreateAndFire(string projCode, Vector3d position, Vector3d direction, bool gravity = false) { var curProj = RawCreate(projCode); int id = NDProjectileBucket.Add(curProj); curProj.Prepare(id, position, (a) => false, (a) => false, (a) => { }, false); curProj.InitializeFree(direction, (a) => false, gravity); ProjectileManager.Fire(curProj); return(curProj); }
//instantiate commander object public static void AddController(AgentController agentController) //, string defaultController { if (PlayerManager.ContainsController(agentController)) { Debug.Log("BOOM"); return; } agentController.PlayerIndex = AgentControllers.Add(agentController); if (MainController == null) { MainController = agentController; } // CreatePlayerObject(agentController, defaultController); }
/// <summary> /// Registers an object and returns a ticket to access variable info about the object. /// Note: Ticket may vary on multiple clients and sessions. /// </summary> /// <param name="lockstepObject">Lockstep object.</param> public static int Register(object lockstepObject) { Type type = lockstepObject.GetType(); string[] propertyNames; LSVariableContainer container; if (!CachedLockstepPropertyNames.TryGetValue(type, out propertyNames)) { bufferPropertyNames.FastClear(); container = new LSVariableContainer(GetVariables(lockstepObject, type)); foreach (LSVariable info in container.Variables) { bufferPropertyNames.Add(info.Info.Name); } CachedLockstepPropertyNames.Add(type, bufferPropertyNames.ToArray()); } else { container = new LSVariableContainer(GetVariables(lockstepObject, type, propertyNames)); } return(Containers.Add(container)); }
public void AddBuff(Buff buff) { buff.ID = Buffs.Add(buff); }
internal void AddBuff(Buff buff) { buff.ID = Buffs.Add(buff); }
public static void Assimilate(Cover cover) { cover.ID = (ushort)Covers.Add(cover); cover.Version = _Version; }
public int Board(MessagePassenger passenger) { return(Passengers.Add(passenger)); }