public static int AddNode(PartitionNode node) { int activationID = ActivatedNodes.Add(node); AllocatedNodes.Add(node); return(activationID); }
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 void CoverHealth(Health health) { health.shieldIndex = shieldedHealths.Add(health); health.OnTakeProjectile += OnTakeDamage; health.Agent.onDeactivation += OnCoveredDie; health.Protect(this); }
public void AddToSelection(LSAgent 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); }
public static void AddController(AgentController agentController) { agentController.PlayerIndex = AgentControllers.Add(agentController); if (MainController == null) { MainController = agentController; } }
public void Add(int item) { if (Count == 0) { activationID = Partition.ActivatedNodes.Add(this); } ContainedObjects.Add(item); }
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); }
public static LSProjectile NDCreateAndFire(string projCode, Vector3d position, Vector3d direction, bool gravity = false) { 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); }
public static void AddController(AgentController agentController) { if (PlayerManager.ContainsController(agentController)) { return; } agentController.PlayerIndex = AgentControllers.Add(agentController); if (MainController == null) { MainController = agentController; } }
/// <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)); }
internal void AddBuff(Buff buff) { buff.ID = Buffs.Add(buff); }
public int Board(MessagePassenger passenger) { return(Passengers.Add(passenger)); }
public void AddToSelection(LSAgent agent) { SelectedAgents.Add(agent); SelectionChanged = true; }
internal static void Assimilate(LSTrigger trigger) { trigger.ID = AssimilatedTriggers.Add(trigger); }