private IEnumerable <SpawnRange> GetLevelSpawns(int level) { foreach (TK key in this.spawns.Keys) { SpawnRange spawn = this.spawns[key]; if (spawn.Range.Min <= level && level < spawn.Range.Max) { yield return(spawn); } } }
void ICollection <SpawnRange> .Add(SpawnRange range) { if (range.Rate < 0) { throw new ArgumentException("Spawn rate must be 0 or higher."); } if (range.Range.Length <= 0) { throw new ArgumentException("Spawn range must be 1 or higher."); } this.spawns.Add(range); }
public bool CanPick(int level) { foreach (TK key in this.spawns.Keys) { SpawnRange spawn = this.spawns[key]; if (spawn.Range.Min <= level && level < spawn.Range.Max && spawn.Rate > 0) { return(true); } } return(false); }
public SpawnDict <TK, TV> GetSpawnList(int level) { SpawnDict <TK, TV> newList = new SpawnDict <TK, TV>(); foreach (TK key in this.spawns.Keys) { SpawnRange spawn = this.spawns[key]; if (spawn.Range.Min <= level && level < spawn.Range.Max) { newList.Add(key, spawn.Spawn, spawn.Rate); } } return(newList); }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); if (m_Active) { list.Add(1060742); // active } else { list.Add(1060743); // inactive } list.Add(1060656, String.Format("{0}/{1}", TotalSpawned.ToString(), Count.ToString())); list.Add(1060663, "SpawnName\t{0}", SpawnName); list.Add(1060662, "Speed\t{0} to {1}", MinDelay, MaxDelay); list.Add(1060658, "SpawnRange\t{0}", SpawnRange.ToString()); list.Add(1060659, "HomeRange\t{0}", HomeRange.ToString()); list.Add(1060660, "Group\t{0}", Group); list.Add(1060661, "Team\t{0}", Team); }
public SplitGroup(GameObject owner, GameObject split) { this.owner = owner; this.split = split; this.origin = (owner.transform.position + split.transform.position) / 2f; this.elapsedTime = 0f; SpawnRange range = owner.GetComponentInChildren <SpawnRange>(); this.rotationVector = Quaternion.Euler(new Vector3(0f, Random.Range(-180f, 180f), 0f)) * (Vector3.one * range.radius); this.rotationVector.y = 0f; AIUnit ownerUnit = owner.GetComponent <AIUnit>(); AIUnit splitUnit = split.GetComponent <AIUnit>(); if (ownerUnit != null && splitUnit != null && ownerUnit.targetEnemy != null) { splitUnit.targetEnemy = ownerUnit.targetEnemy; } }
public SplitGroup(GameUnit ownerUnit, GameUnit splitUnit, float angle, float splitFactor) { this.ownerUnit = ownerUnit; this.splitUnit = splitUnit; this.elapsedTime = 0f; this.origin = ownerUnit.gameObject.transform.position; this.splitFactor = splitFactor; SpawnRange range = this.ownerUnit.GetComponentInChildren <SpawnRange>(); this.rotationVector = Quaternion.Euler(0f, angle, 0f) * (Vector3.one * range.radius); this.rotationVector.y = 0f; NavMeshAgent agent = this.ownerUnit.GetComponent <NavMeshAgent>(); if (agent != null) { agent.ResetPath(); agent.Stop(); } agent = this.splitUnit.GetComponent <NavMeshAgent>(); if (agent != null) { agent.ResetPath(); agent.Stop(); } NetworkTransform transform = this.ownerUnit.GetComponent <NetworkTransform>(); if (transform != null) { transform.transformSyncMode = NetworkTransform.TransformSyncMode.SyncNone; } transform = this.splitUnit.GetComponent <NetworkTransform>(); if (transform != null) { transform.transformSyncMode = NetworkTransform.TransformSyncMode.SyncNone; } }
bool ICollection <SpawnRange> .Remove(SpawnRange randRange) { return(this.spawns.Remove(randRange)); }
bool ICollection <SpawnRange> .Contains(SpawnRange item) { return(this.spawns.Contains(item)); }