示例#1
0
 public void RemoveSelectedSlotEnergy()
 {
     if (m_SelectedSlot.EnergyType != null)
     {
         m_EnergyManager.AddEnergy(m_SelectedSlot.EnergyType.Value);
         m_SelectedSlot.ClearSlot();
     }
 }
示例#2
0
    public void OnResourcePickedUp(GameConstants.eEnergyType energy)
    {
        m_EnergyManager.AddEnergy(energy);

        if (m_ParticlesDictionary.ContainsKey(energy))
        {
            m_ParticlesDictionary[energy].Emit(1);
        }
    }
示例#3
0
//	void Start(){
//
//	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <Player_Script>() == null)
        {
            return;
        }
        EnergyManager.AddEnergy(energyToAdd);
        energyAudio.Play();
        Destroy(gameObject);
    }
示例#4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.name == "Player")
        {
            theEnergyManager.AddEnergy(energyToGive);
            gameObject.SetActive(false);

            if (energySound.isPlaying)
            {
                energySound.Stop();
                energySound.Play();
            }
            else
            {
                energySound.Play();
            }
        }
    }
示例#5
0
 public override void OnKill(DamageReciever victim)
 {
     MyEnergyManager.AddEnergy(OnKillEnergyIncrease);
 }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        if (powerupActive)
        {
            //Modify this with - sign.
            powerupLengthCounter -= Time.deltaTime;

            if (theGameManager.powerupReset)
            {
                powerupLengthCounter        = 0;
                theGameManager.powerupReset = false;
            }

            if (safeMode)
            {
                //thePlatformGenerator.randomSpikeThreshold = 0f;
            }

            if (flyingMode)
            {
                if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
                {
                    powerupLengthCounter = 0;
                }
            }

            if (extraEnergy)
            {
                theEnergyManager.AddEnergy(20);
                extraEnergy       = false;
                powerupTimer.text = "";
            }

            if (doublePoints)
            {
                //theScoreManager.scoreCount += 200;
                powerupTimer.text = "";
            }


            if (powerupLengthCounter <= 0)
            {
                theScoreManager.pointsPerSecond = normalPointsPerSecond;
                thePlayer.GetComponent <Rigidbody2D> ().constraints = normalConstraints;
                theEnergyManager.energyDecreasing = true;
                spikeList = FindObjectsOfType <PlatformDestroyer> ();
                for (int i = 0; i < spikeList.Length; i++)
                {
                    if (spikeList [i].gameObject.name.Contains("KingLouie") ||
                        spikeList [i].gameObject.name.Contains("Snake") ||
                        spikeList [i].gameObject.name.Contains("Hyna"))
                    {
                        //spikeList [i].gameObject.SetActive (false);
                        spikeList [i].gameObject.tag = "killbox";
                    }
                }

                safeMode   = false;
                flyingMode = false;

                powerupActive     = false;
                powerupTimer.text = "";
            }
            else
            {
                if (flyingMode || safeMode)
                {
                    powerupTimer.text = ((int)(powerupLengthCounter) + 1).ToString();
                }
            }
        }
    }
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "killbox")
        {
            /*theGameManager.RestartGame ();
             *          moveSpeed = moveSpeedStore;
             *          speedMilestoneCount = speedMilestoneCountStore;
             *          speedupMilestone = speedupMilestoneStore;
             *
             *          deathSound1.Play ();
             *          //deathSound2.Play ();
             *          backgroundSound.Stop ();
             */
            deathSound1.Play();
            int heart = 0;
            if (PlayerPrefs.HasKey("Hearts"))
            {
                heart = PlayerPrefs.GetInt("Hearts");
            }
            int newHearts = heart - 1;
            if (newHearts <= 0)
            {
                newHearts = 0;
                theGameManager.RestartGame();
                moveSpeed           = moveSpeedStore;
                speedMilestoneCount = speedMilestoneCountStore;
                speedupMilestone    = speedupMilestoneStore;

                backgroundSound.Stop();
            }
            PlayerPrefs.SetInt("Hearts", newHearts);
            other.gameObject.SetActive(false);
            BlinkPlayer();
        }
        else if (other.gameObject.tag == "obstacle")
        {
            theEnergyManager.AddEnergy(energyToSubtract);
            powerDown.Play();
            other.gameObject.SetActive(false);
            BlinkPlayer();
        }
        else if (other.gameObject.tag == "safeenemy")
        {
            killEnemy.Play();
            other.gameObject.SetActive(false);
        }
        else if (other.gameObject.tag == "TeleportWaterWorld")
        {
            GameController.setArguments(moveSpeed, theScoremanager.scoreCount, theEnergyManager.energyCount, speedupMilestone, backgroundSound.time);
            SceneManager.LoadScene(level2);
            // Application.LoadLevel (level2);
        }
        else if (other.gameObject.tag == "heart")
        {
            int heart = 0;
            if (PlayerPrefs.HasKey("Hearts"))
            {
                heart = PlayerPrefs.GetInt("Hearts");
            }
            int newHearts = heart + 1;
            if (newHearts >= 5)
            {
                newHearts = 5;
            }
            PlayerPrefs.SetInt("Hearts", newHearts);
            other.gameObject.SetActive(false);
        }
    }