private void ReleaseZombieInstanceImplementation(ushort instance, ref ZombieInstance data) { ZombieInfo info = data.Info; if (info != null) { info.m_zombieAI.ReleaseInstance(instance, ref this.m_instances.m_buffer[(int)instance]); } data.Unspawn(instance); InstanceID id = default(InstanceID); id.CitizenInstance = instance; Singleton <InstanceManager> .instance.ReleaseInstance(id); if (data.m_path != 0u) { Singleton <PathManager> .instance.ReleasePath(data.m_path); data.m_path = 0u; } if (data.m_zombie != 0u) { this.m_zombies.m_buffer[(int)((UIntPtr)data.m_zombie)].m_instance = 0; data.m_zombie = 0u; } data.m_flags = ZombieInstance.Flags.None; this.m_instances.ReleaseItem(instance); this.m_instanceCount = (int)(this.m_instances.ItemCount() - 1u); }
public virtual void SimulationStep(ushort instanceID, ref ZombieInstance data, Vector3 physicsLodRefPos) { Logger.LogClassAndMethodName(this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name); Logger.Log("2"); if ((data.m_flags & ZombieInstance.Flags.Character) != ZombieInstance.Flags.None) { Logger.Log(data.m_flags.ToString()); ZombieInstance.Frame lastFrameData = data.GetLastFrameData(); int num = Mathf.Clamp((int)(lastFrameData.m_position.x / 8f + 1080f), 0, 2159); int num2 = Mathf.Clamp((int)(lastFrameData.m_position.z / 8f + 1080f), 0, 2159); bool lodPhysics = Vector3.SqrMagnitude(physicsLodRefPos - lastFrameData.m_position) >= 62500f; this.SimulationStep(instanceID, ref data, ref lastFrameData, lodPhysics); int num3 = Mathf.Clamp((int)(lastFrameData.m_position.x / 8f + 1080f), 0, 2159); int num4 = Mathf.Clamp((int)(lastFrameData.m_position.z / 8f + 1080f), 0, 2159); if ((num3 != num || num4 != num2) && (data.m_flags & ZombieInstance.Flags.Character) != ZombieInstance.Flags.None) { Singleton <ZombieManager> .instance.RemoveFromGrid(instanceID, ref data, num, num2); Singleton <ZombieManager> .instance.AddToGrid(instanceID, ref data, num3, num4); } if (data.m_flags != ZombieInstance.Flags.None) { data.SetFrameData(Singleton <SimulationManager> .instance.m_currentFrameIndex, lastFrameData); } } }
public void RemoveFromGrid(ushort instance, ref ZombieInstance data, int gridX, int gridZ) { int num = gridZ * 2160 + gridX; ushort num2 = 0; ushort num3 = this.m_zombieGrid[num]; int num4 = 0; while (num3 != 0) { if (num3 == instance) { if (num2 == 0) { this.m_zombieGrid[num] = data.m_nextGridInstance; } else { this.m_instances.m_buffer[(int)num2].m_nextGridInstance = data.m_nextGridInstance; } break; } num2 = num3; num3 = this.m_instances.m_buffer[(int)num3].m_nextGridInstance; if (++num4 > 65536) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } data.m_nextGridInstance = 0; }
public void AddToGrid(ushort instance, ref ZombieInstance data, int gridX, int gridZ) { int num = gridZ * 2160 + gridX; data.m_nextGridInstance = this.m_zombieGrid[num]; this.m_zombieGrid[num] = instance; }
public void RemoveFromGrid(ushort instance, ref ZombieInstance data) { ZombieInstance.Frame lastFrameData = data.GetLastFrameData(); int gridX = Mathf.Clamp((int)(lastFrameData.m_position.x / 8f + 1080f), 0, 2159); int gridZ = Mathf.Clamp((int)(lastFrameData.m_position.z / 8f + 1080f), 0, 2159); this.RemoveFromGrid(instance, ref data, gridX, gridZ); }
public void Spawn(ushort instanceID) { if ((this.m_flags & ZombieInstance.Flags.Character) == ZombieInstance.Flags.None) { ZombieInstance mFlags = this; mFlags.m_flags = mFlags.m_flags | ZombieInstance.Flags.Character; Singleton <ZombieManager> .instance.AddToGrid(instanceID, ref this); } }
public void Unspawn(ushort instanceID) { if ((this.m_flags & ZombieInstance.Flags.Character) != ZombieInstance.Flags.None) { Singleton <ZombieManager> .instance.RemoveFromGrid(instanceID, ref this); ZombieInstance mFlags = this; mFlags.m_flags = mFlags.m_flags & (ZombieInstance.Flags.Created | ZombieInstance.Flags.Deleted | ZombieInstance.Flags.InsideBuilding | ZombieInstance.Flags.WaitingPath | ZombieInstance.Flags.OnPath | ZombieInstance.Flags.AtTarget); } }
public override void RenderMesh(RenderManager.CameraInfo cameraInfo) { Vector3 position = new Vector3(0f, 60f, 0f); ZombieInstance.RenderInstance(cameraInfo, this, position); }
public virtual void ReleaseInstance(ushort instanceID, ref ZombieInstance data) { this.SetSource(instanceID, ref data, 0); this.SetTarget(instanceID, ref data, 0); }
public virtual void SetTarget(ushort instanceID, ref ZombieInstance data, ushort targetBuilding) { }
public virtual void SetSource(ushort instanceID, ref ZombieInstance data, ushort sourceBuilding) { }
public virtual void CreateInstance(ushort instanceID, ref ZombieInstance data) { }
public virtual void SimulationStep(ushort instanceID, ref ZombieInstance citizenData, ref ZombieInstance.Frame frameData, bool lodPhysics) { Logger.LogClassAndMethodName(this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name); Logger.Log("3"); }