Example #1
0
 protected void OnDisable()
 {
     if (doneSpawning)
     {
         rigidbody.velocity = Vector3.zero;
         if (catParticlePool == null)
         {
             catParticlePool = TapGOPoolSingleton <CatParticle> .PoolInstance();
         }
         TapGameObject particle = catParticlePool.GetObject();
         if (particle)
         {
             particle.gameObject.SetActive(true);
             particle.GetComponent <CatParticle>().PlayAtLocation(transform.position);
         }
         else
         {
             Debug.LogError("Could not play particle system");
         }
         gameManager.IncScore(1);
         popSound.Play();
     }
     doneSpawning = false;
     base.OnDisable();
 }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        tapAreaSound      = AudioManager.Instance().GetAudioSource("TapAreaSound");
        activeTapAreaPool = TapGOPoolSingleton <TapArea> .ActivePoolInstance();

        tapAreaPool = TapGOPoolSingleton <TapArea> .PoolInstance();

        if (!activeTapAreaPool || !tapAreaPool)
        {
            Debug.LogError("Cannot find activeTapAreaPool!");
        }
    }
Example #3
0
    // Use to remove the tap area and make it disappear.
    //void FixedUpdate()
    //{
    //    if (false)
    //    //if (alreadyActive == true)
    //    {
    //        timeLeftTapArea += Time.deltaTime;
    //
    //        // this.rend.material.color = Color.Lerp(red, grey, timeLeftTapArea/timeLengthTapArea);
    //        if (timeLengthTapArea / 2 <= timeLeftTapArea)
    //        {
    //            //if changing color from red -> gray
    //            if (MoveUp == true)
    //            {
    //                float moveY = (transform.position.y - .02f);
    //                transform.position = new Vector3(this.transform.position.x, moveY, this.transform.position.z);
    //                this.gameObject.GetComponent<MeshRenderer>().material = material2;
    //                MoveUp = false;
    //            }
    //        }
    //        //reset and remove the TapArea
    //        if (timeLengthTapArea <= timeLeftTapArea)
    //        {
    //            alreadyActive = false;
    //            timeLeftTapArea = 0f;
    //            rend.material = material1;
    //            this.gameObject.SetActive(false);
    //            MoveUp = false;
    //        }
    //    }
    //}



    // Use this for initialization
    void Awake()
    {
        activeEnemyPool = TapGOPoolSingleton <Enemy> .ActivePoolInstance();

        if (!activeEnemyPool)
        {
            Debug.LogError("Could not find active enemy pool!");
        }
        rend = this.GetComponent <Renderer>();
        red  = material1.color;
        grey = material2.color;
        transform.localScale = new Vector3(radius * 2, radius * 2, radius * 2);
    }
Example #4
0
    void Start()
    {
        enemyPool = TapGOPoolSingleton <Enemy> .CreatePool(enemyPrefab, enemyPoolAmount);

        tapAreaPool = TapGOPoolSingleton <TapArea> .CreatePool(tapAreaPrefab, tapAreaPoolAmount);

        catParticlePool = TapGOPoolSingleton <CatParticle> .CreatePool(catParticlePrefab, catParticlePoolAmount);

        if (enemyPool == null || tapAreaPool == null || !playerBase || !catParticlePool)
        {
            Debug.LogError("GameObjectPool creation failed!");
        }
    }
Example #5
0
    // Use this for initialization
    void Awake()
    {
        target          = GameManager.Instance().playerBase.transform;
        spawnPoints     = new List <Transform>();
        activeEnemyPool = TapGOPoolSingleton <Enemy> .ActivePoolInstance();

        enemyPool = TapGOPoolSingleton <Enemy> .PoolInstance();

        if (!activeEnemyPool || !enemyPool || !target)
        {
            Debug.LogError("Cannot find activeEnemyPool!");
        }

        // Build the spawner list from child objects with the "spawner" tag
        foreach (Transform t in transform.GetComponentsInChildren <Transform>())
        {
            if (t.tag == "Spawner")
            {
                spawnPoints.Add(t);
            }
        }
        currtime = 0f;
        nexttime = timeBetweenSpawns;
    }