public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { gameObject = animator.gameObject; destinationSetter = gameObject.GetComponent <AIDestinationSetter>(); aiPath = gameObject.GetComponent <AIPath>(); npc = gameObject.GetComponent <NPC>(); clown = gameObject.GetComponent <Clown>(); var gm = GameObject.FindGameObjectWithTag("GameManager"); gameManager = gm.GetComponent <GameManager>(); layoutManager = gm.GetComponent <LayoutGenerator>(); // Set Location npc.DestinationSlave.transform.position = layoutManager.GetRandomSpawnPoint(); destinationSetter.target = npc.DestinationSlave.transform; // Make friend follow clown friend = npc.ClosestFriend; friend.GetComponent <Friend>().OnGetKidnapped(); clown.KidnappedFriend = friend; animator.SetBool("Is Kidnapping", true); }
private void SpawnCharacters() { if (playerPrefab != null) { Vector3 playerSpawn = generator.GetPlayerSpawnPoint(); Destroy(Player); Player = ControlledObject = Instantiate(playerPrefab, playerSpawn, Quaternion.identity); } if (clownPrefab != null) { Vector3 clownSpawn = generator.GetRandomSpawnPoint(); Destroy(Clown); Clown = Instantiate(clownPrefab, clownSpawn, Quaternion.identity); } if (friendPrefab != null) { SpawnFriends(); } }