Exemplo n.º 1
0
        public static int AddNode(PartitionNode node)
        {
            int activationID = ActivatedNodes.Add(node);

            AllocatedNodes.Add(node);
            return(activationID);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 public static void AddController(AgentController agentController)
 {
     if (PlayerManager.ContainsController(agentController))
     {
         return;
     }
     agentController.PlayerIndex = AgentControllers.Add(agentController);
     if (MainController == null)
     {
         MainController = agentController;
     }
 }
Exemplo n.º 11
0
        /// <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));
        }
Exemplo n.º 12
0
 internal void AddBuff(Buff buff)
 {
     buff.ID = Buffs.Add(buff);
 }
Exemplo n.º 13
0
 public int Board(MessagePassenger passenger)
 {
     return(Passengers.Add(passenger));
 }
Exemplo n.º 14
0
 public void AddToSelection(LSAgent agent)
 {
     SelectedAgents.Add(agent);
     SelectionChanged = true;
 }
Exemplo n.º 15
0
 internal static void Assimilate(LSTrigger trigger)
 {
     trigger.ID = AssimilatedTriggers.Add(trigger);
 }