// Start is called before the first frame update
 void Start()
 {
     weaponScript = gameObject.GetComponent <Weapon>();
     try {
         SwitchBetweenAttackAndSpawnMode gameManager = GameObject.FindWithTag("GameManager").GetComponent <SwitchBetweenAttackAndSpawnMode>();
         gameManager.runAttackMode += CheckForAttack;
     } catch {
         throw new System.ArgumentException("Couldn't Add CheckForAttack() Function To runAttackMode Event");
     }
 }
Beispiel #2
0
        // Start is called before the first frame update
        void Start()
        {
            try {
                gameManager = GameObject.FindWithTag("GameManager").GetComponent <SwitchBetweenAttackAndSpawnMode>();
                gameManager.switchFromAttackToSpawn += SwitchFromAttackToSpawnUI;
                gameManager.switchFromSpawnToAttack += SwitchFromSpawnToAttackUI;
            } catch {
                throw new System.ArgumentException("Couldn't Add updateStateUI() Function To Events");
            }

            pageController.TurnPageOn(PageType.Attack);
        }
Beispiel #3
0
    void Start()
    {
        try {
            gameManager = GameObject.FindWithTag("GameManager").GetComponent <SwitchBetweenAttackAndSpawnMode>();
            gameManager.switchFromSpawnToAttack += setPitchForkActive;
            gameManager.switchFromAttackToSpawn += setPitchForkInActive;
        } catch {
            throw new System.ArgumentException("Couldn't Add setPitchForkActive() and setPitchForkInActive() to events");
        }

        groundMask = LayerMask.GetMask("Environment");
        controller = GetComponent <CharacterController>();
        animator   = GetComponentInChildren <Animator>();
        if (!animator)
        {
            Debug.LogWarning("No animator found");
        }
    }
Beispiel #4
0
    // Start is called before the first frame update
    void Start()
    {
        try {
            GameObject animalManager = GameObject.FindWithTag("AnimalManager");
            UnlockedAnimals = animalManager.GetComponent <AnimalManager>().UnlockedAnimals;
        } catch {
            throw new System.ArgumentException("Could not create list of unlocked animals, make sure you have an animal manager with an animal manager tag");
        }
        try {
            SwitchBetweenAttackAndSpawnMode gameManager = GameObject.FindWithTag("GameManager").GetComponent <SwitchBetweenAttackAndSpawnMode>();
            gameManager.runSpawnMode            += CheckForSpawnAnimal;
            gameManager.switchFromSpawnToAttack += DeactivateSpawnManager;
            gameManager.switchFromAttackToSpawn += ActivateSpawnManager;
        } catch {
            throw new System.ArgumentException("Couldn't Add CheckForSpawnAnimal() Function To runSpawnMode Event");
        }

        playerSelectedAnimal = UnlockedAnimals[0];
        spawnPointsUI.text   = spawnPoints.ToString();
        DeactivateSpawnManager();
    }