Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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();
        }
    }