Example #1
0
    void Start()
    {
        audioManager   = AudioManager.instance;
        anim           = GetComponent <Animator>();
        castleCollider = CastleCollider.instance;

        projectilesParent = GameObject.Find(PROJECTILES_PARENT_NAME).transform;
        gun = transform.Find("Gun").gameObject;

        startingBluntDamage    = bluntDamage;
        startingPiercingDamage = piercingDamage;
        startingFireDamage     = fireDamage;
        startingHealAmount     = healAmount;

        if (startingHealAmount > 0)
        {
            isHealer = true;
        }

        // Find which object pool to use for this shooter's projectiles
        for (int i = 0; i < projectilesParent.childCount; i++)
        {
            if (projectilesParent.GetChild(i).TryGetComponent(out ObjectPool objPool))
            {
                if (objPool.objectToPool == projectilePrefab)
                {
                    projectileObjectPool = objPool;
                }
                else if (objPool.objectToPool == secondaryProjectilePrefab)
                {
                    secondaryProjectileObjectPool = objPool;
                }
            }
        }
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }