void SpawnShip() { Vector2 spawnPoint = Vector2.zero; Collider2D hit = null; //assigned just to get the compiler to shut up for (int i = 0; i < 10; i++) { spawnPoint = spawningRange * Random.insideUnitCircle; hit = Physics2D.OverlapCircle(spawnPoint, spawningClearance, shipLayerMask); if (hit == null) { break; } } if (hit != null) { Debug.Log("No Valid Spawning Places found"); } Ship spawnedShip = (Instantiate(shipPrefab, spawnPoint, RandomLib.Random2DRotation()) as GameObject).GetComponent <Ship>(); spawnedShip.Side = side; spawnedShip.Subscribe <ShipDestroyedMessage>(this); Debug.Log("Spawned New Ship!"); }
public ExampleSearchModel() { int numOfChar = RandomLib.random.Next(5, 15); this.ID = RandomLib.RandomString(numOfChar, false); this.Description = "Just a property to fill out this object."; }
public static bool Fire(this IRandomAbility ability, Vector2 direction, int seed) { Random.seed = seed; bool result = ability.Fire(direction); RandomLib.ReSeed(); return(result); }
IEnumerator LocalGoalSpawning() { for (; ;) { yield return(new WaitForSeconds(RandomLib.RandFloatRange(spawnTime, spawnTimeVariance))); spawnSuperGoals(Random.Range(0, spawnPositions.Length)); } }
IEnumerator ServerGoalSpawning() { for (; ;) { yield return(new WaitForSeconds(RandomLib.RandFloatRange(spawnTime, spawnTimeVariance))); node.BinaryWriter.Write(PacketType.SUPERGOALSPAWNING); byte spawnPointIndex = (byte)Random.Range(0, spawnPositions.Length); node.BinaryWriter.Write(spawnPointIndex); node.Send(node.AllCostChannel); spawnSuperGoals(spawnPointIndex); } }
bool activateAndSend(PacketType packetType, Vector2 direction, byte playerID, AbstractAbility ability) { if (!_abilitiesEnabled) { return(false); } int seed = -1; bool activated; if (ability is IRandomAbility) { seed = RandomLib.Seed(); activated = ((IRandomAbility)ability).Fire(direction, seed); } else { activated = ability.Fire(direction); } if (activated) { node.BinaryWriter.Write((byte)(packetType)); node.BinaryWriter.Write(playerID); node.BinaryWriter.Write(direction); if (ability is IRandomAbility) { node.BinaryWriter.Write(true); node.BinaryWriter.Write(seed); } else { node.BinaryWriter.Write(false); } node.Send(node.ConnectionIDs, node.AllCostChannel); } return(activated); }
public void Notify(DoubleLeftMouseClickMessage m) { Ship spawnedShip = (Instantiate(enemyShip, m.worldPoint, RandomLib.Random2DRotation()) as GameObject).GetComponent <Ship>(); spawnedShip.Side = 1; }