// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Sheep sheep = animator.GetComponent <Sheep>(); SpawnManager manager = Instances.GetSpawnManager(); GameStatus game = Instances.GetGameStatus(); Vector3 position = sheep.transform.position; Destroy(sheep.gameObject); game.sheepRemoved(false); Instantiate(manager.wolfPrefab, position, Quaternion.identity); game.wolfAdded(); }
/** * Spawns all the entities across the map */ private void Start() { _rand = new Random(); /* Discards the first non-random value (yeah... you suck, .NET) */ _rand.Next(); _commBus = Instances.GetGameStatus(); /* Adds random food types until all the food points are filled */ foreach (GameObject point in foodSpawnPoints) { int idx = _rand.Next(foodPrefabs.Length); Food foodItem = foodPrefabs[idx]; Instantiate(foodItem, point.transform); } StartCoroutine(calcSpawmns()); }
/** * Removes this sheep from the game */ public void Die() { /* We assume that sheep inside of the pen are safe and cannot die */ Instances.GetGameStatus().sheepRemoved(false); Destroy(this.gameObject); }
// Start is called before the first frame update void Start() { _commbus = Instances.GetGameStatus(); }