private void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Exemple #2
0
 void NewQuest()
 {
     currentQuest = GenerateQuest();
     if (currentQuest.type == 1)
     {
         PowerupSystem.ChoosePowerup(1);
     }
     DestroyChild();
     SpawnObjectsPerQuest();
     Debug.Log(currentQuest.questText);
 }
Exemple #3
0
    void Start()
    {
        PowerupSystem.ChangePowerup(PowerupSystem.Powerups.None);

        joystickPosition = new Vector2(
            Screen.width / 2, Screen.height / 8
            );

        Physics.autoSimulation = true;
        gm.paused = false;

        bounds = mesh.GetComponent <MeshRenderer>().bounds;
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        if (once)
        {
            OneUpdate();
            once = false;
        }

        if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Fire))
        {
            if (!particleSystems[0].isPlaying)
            {
                particleSystems[0].Play(); // 0 is Fire
            }
        }
        else
        {
            particleSystems[0].Stop(withChildren: true);
        }

        if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Vortex))
        {
            if (!particleSystems[1].isPlaying)
            {
                particleSystems[1].Play(); // 1 is Vortex
            }
        }
        else
        {
            particleSystems[1].Stop(withChildren: true);
        }

        if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Magnet))
        {
            if (!particleSystems[2].isPlaying)
            {
                particleSystems[2].Play(); // 0 is Fire
            }
        }
        else
        {
            particleSystems[2].Stop(withChildren: true);
        }
    }
Exemple #5
0
 // Update is called once per frame
 void Update()
 {
     if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Fire))
     {
         DisableAll();
         Mechanics[0].SetActive(true);
     }
     else if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Vortex))
     {
         DisableAll();
         Mechanics[1].SetActive(true);
     }
     else if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.Magnet))
     {
         DisableAll();
         Mechanics[2].SetActive(true);
     }
     else
     {
         DisableAll();
     }
 }
Exemple #6
0
    void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag.Equals("Button/Normal"))
        {
            other.gameObject.GetComponent <LoadLevels>().Load();
        }
        else
        {
            int tmp = ObjectSystem.IsObjectHittable(other.gameObject.tag);
            if (tmp != -1)
            {
                if (!isEndless)
                {
                    if (other.tag.Equals("Object/Popcorn"))
                    {
                        targetScale += new Vector3(0.01f, 0f, 0.01f);
                    }
                    else
                    {
                        if (PowerupSystem.IsCurrentPowerup(PowerupSystem.Powerups.DoubleSize))
                        {
                            targetScale += new Vector3(scale * 2, 0f, scale * 2);
                        }
                        else
                        {
                            targetScale += new Vector3(scale, 0f, scale);
                        }

                        cylinder.transform.localScale += new Vector3(0, 0.5f, 0);
                        cam.newTargetVector();
                    }
                }

                Destroy(other.gameObject);
                PowerupSystem.ChoosePowerup(tmp);
            }
        }
    }
Exemple #7
0
    void UpdateQuestNumbers()
    {
        switch (currentQuest.type)
        {
        case 0:
            currentQuest.currentEaten.x = currentQuest.numberCondition.x - goodCondition.transform.childCount;
            currentQuest.currentEaten.y = currentQuest.numberCondition.y - badCondition.transform.childCount;
            break;

        case 1:
            currentQuest.currentEaten.x = currentQuest.numberCondition.x - goodCondition.transform.childCount;
            if (PowerupSystem.GetCurrentPowerup() == PowerupSystem.Powerups.None)
            {
                currentQuest.currentEaten.y = -1;
            }
            break;

        case 2:
            currentQuest.currentEaten.x = currentQuest.numberCondition.x - goodCondition.transform.childCount;
            currentQuest.timePassed    += Time.deltaTime;
            break;
        }
    }
Exemple #8
0
	void Start(){
		powerupSystem = GameObject.Find("PowerupSystem").GetComponent<PowerupSystem>();
	}
 // Use this for initialization
 void Start()
 {
     powerupPool.Initialize();
     GenerateTypeMap();
     instance = this;
 }
Exemple #10
0
 public virtual void Init(StatHandler statHandler, PowerupSystem system, float lifeTime)
 {
 }
 public override void Init(StatHandler statHandler, PowerupSystem system, float lifeTime)
 {
     this.statHandler = statHandler;
     this.lifeTime    = lifeTime;
     weaponSystem     = system.GetComponent <IWeaponSystem>();
 }
 public override void Init(StatHandler statHandler, PowerupSystem system, float lifeTime)
 {
     this.statHandler = statHandler;
     this.lifeTime    = lifeTime;
 }