public void UseItem1()
 {
     if (canActivate1)
     {
         if (slot1 != null)
         {
             if (slot1.hasDuration)
             {
                 powerTimer1 = slot1.duration;
                 activated1  = true;
                 slot1.ActivatePowerUp(competitor.Name, competitor.origin);
                 if (!usedPowerup)
                 {
                     PAT.TooglePowerupUsed();
                     usedPowerup = true;
                 }
             }
             else
             {
                 slot1.ActivatePowerUp(competitor.Name, competitor.origin);
                 slot1 = null;
                 if (!usedPowerup)
                 {
                     PAT.TooglePowerupUsed();
                     usedPowerup = true;
                 }
             }
             UpdateUI();
         }
     }
 }
 public void UseItem2()
 {
     if (canActivate2)
     {
         if (slot2 != null)
         {
             if (slot2.hasDuration)
             {
                 powerTimer2 = slot2.duration;
                 activated2  = true;
                 slot2.ActivatePowerUp(competitor.Name, competitor.origin);
                 if (!usedPowerup)
                 {
                     PAT.TooglePowerupUsed();
                     usedPowerup = true;
                 }
             }
             else
             {
                 slot2.ActivatePowerUp(competitor.Name, competitor.origin);
                 slot2 = null;
                 if (!usedPowerup)
                 {
                     PAT.TooglePowerupUsed();
                     usedPowerup = true;
                 }
             }
             UpdateUI();
         }
     }
 }
    IEnumerator UpdateDecision()
    {
        // wait after decision was made to make a new decision
        yield return(new WaitForSeconds(updateDecisionDelay));

        decisionMade = false;
        if (!dead && started)
        {
            forwardTicker = forwardTimer;
            decision      = 0;
            if (decisionScr.choice1.GetComponent <ChoiceScript>().description == "PowerUp")
            {
                powerUp.ActivatePowerUp();
            }
            if (decisionsAlive == 0)
            {
                GameObject _newDecision = GetDecisionWithProb();
                if (_newDecision == lastDecision)
                {
                    //Debug.Log("That decision just happened! Try again!");
                    _newDecision = GetDecisionWithProb();
                }
                decisionScr = Instantiate(_newDecision.GetComponent <DecisionScript>());
                decisionsAlive++;
                lastDecision = _newDecision;
            }
        }
    }
 private void Update()
 {
     if (Input.GetButtonDown("PowerUp"))
     {
         _powerUp.ActivatePowerUp();
     }
 }
 public static void UpdateFreePowerUpStatus(bool rewardedVideoWatched)
 {
     if (rewardedVideoWatched)
     {
         currentRewardedVideoRequestedPowerUp.ActivatePowerUp();
         currentRewardedVideoRequestedPowerUp = null;
     }
 }
Exemple #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.GetComponent <DamageDealer>())
     {
         DamageDealer _damageDealer = collision.gameObject.GetComponent <DamageDealer>();
         ProcessHit(_damageDealer);
     }
     else if (collision.gameObject.GetComponent <PowerUp>())
     {
         PowerUp _powerUp = collision.gameObject.GetComponent <PowerUp>();
         _powerUp.ActivatePowerUp();
         Destroy(_powerUp.gameObject.GetComponent <SpriteRenderer>());
     }
 }
    public void ActivatePowerUp(PowerUp powerUp)
    {
        if (!activePowerUps.ContainsKey(powerUp))
        {
            activePowerUps.Add(powerUp, powerUp.ModifyTimer);
            powerUp.ActivatePowerUp();
        }
        else
        {
            activePowerUps[powerUp] = powerUp.ModifyTimer;
        }

        activeKeys = new List <PowerUp>(activePowerUps.Keys);
    }
Exemple #8
0
    private IEnumerator UsePowerUpRoutine(bool _isSlot1)
    {
        if (_isSlot1)
        {
            m_canActivatePowerUp1 = false;
            slot1.ActivatePowerUp(m_competitor.Name, m_competitor.origin);
            yield return(new WaitForSeconds(slot1.duration));

            slot1.ResetEffects(m_competitor.Name);
            slot1 = null;
            m_canActivatePowerUp1 = true;
        }
        else
        {
            m_canActivatePowerUp2 = false;
            slot2.ActivatePowerUp(m_competitor.Name, m_competitor.origin);
            yield return(new WaitForSeconds(slot2.duration));

            slot2.ResetEffects(m_competitor.Name);
            slot2 = null;
            m_canActivatePowerUp2 = true;
        }
    }
Exemple #9
0
    void UserInputs()
    {
        // A  button ou Up Arrow
        if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetButtonDown("360_AButton") || Input.GetKeyDown(KeyCode.W))
        {
            anim.SetBool("Fly", true);
            rbpiegon.velocity = Vector2.zero;
            rbpiegon.AddForce(new Vector2(0, upForce));
            //print ("Je pèse sur A");
        }

        // B button
        if (Input.GetButtonDown("360_BButton"))
        {
            print("Je pèse sur : B button! (dire non au psy)");
        }

        // Bouton X (... 2)
        if (Input.GetButtonDown("360_XButton"))
        {
            print("Je pèse sur: le bouton X! (dire oui au psy)");
        }


//	// Back button (... 6)
//		if (Input.GetButtonDown ("360_BackButton")){
//			print ("Je pèse sur: back button!");
//		}

        // Start button (... 7)						// MIS DANS UN AUTRE SCRIPT
//		if (Input.GetButtonDown ("360_StartButton") || Input.GetKeyDown (KeyCode.Escape)){
//			//print ("Je pèse sur: start button!");
//			if (Time.timeScale == 1) {
//				print ("Je pause le jeu");
//				Time.timeScale = 0;
//				mainUI.SetActive (false);
//				powerupUI.SetActive (false);
//				pauseUI.SetActive (true);
//			} else {
//				print ("Je remets le jeu en marche");
//				Time.timeScale == 1;
//				pauseUI.SetActive (false);
//				mainUI.SetActive (true);
//				powerupUI.SetActive (true);
//			}
//		}

        // D-PAD
        //RIGHT d-pad...
//		if (Input.GetAxis ("360_HorizontalDPAD")>0.001){
//			print ("Right D-PAD button!");
//		}
        // LEFT d-pad....
//		if(Input.GetAxis ("360_HorizontalDPAD")<0){
//			print ("Left D-PAD button!");
//		}
        // UP d-pad...
//		if (Input.GetAxis("360_VerticalDPAD")>0.001){
//			print ("Up D-PAD button!");
//		}
        // DOWN d-pad...
//		if (Input.GetAxis("360_VerticalDPAD")<0){
//			print ("Down D-PAD button!");
//		}

        // LES TRIGGERS
        //Triggers
        if (((Input.GetAxis("360_TriggerL") > 0.001 && Input.GetAxis("360_TriggerR") > 0.001) || Input.GetKeyDown(KeyCode.Space)) && powerupscriptpremier.BeakyGotAPowerUp == true)
        {
            powerupscriptpremier.BeakyGotAPowerUp = false;
            powerupscriptpremier.ActivatePowerUp();
            print("J'utilise le powerup #2!");

//			if (powerupscriptpremier.BeakyGotAPowerUp == true) {
//				powerupscriptpremier.BeakyGotAPowerUp = false;
//				powerupscriptpremier.ActivatePowerUp ();
//				print ("J'utilise le premier powerup!");
//			} else if (powerupscriptpremier.BeakyGotAPowerUp == false){
//				print ("Nope.");
//			}
//
//			if (powerupscriptdeuxieme.BeakyGotAPowerUp = true) {
//				powerupscriptdeuxieme.BeakyGotAPowerUp = false;
//				powerupscriptdeuxieme.ActivatePowerUp ();
//				print ("J'utilise le deuxième powerup!");
//			} else if (powerupscriptdeuxieme.BeakyGotAPowerUp == false){
//				print ("Nope.");
//			}

//		} else if (Input.GetAxis ("360_TriggerL") > 0.001 && Input.GetAxis ("360_TriggerR") < 0.001) {
//			print ("Je pèse juste sur le trigger gauche");
//		} else if (Input.GetAxis ("360_TriggerL") < 0.001 && Input.GetAxis ("360_TriggerR") > 0.001) {
//			print ("Je pèse juste sur le trigger droit");
        }
        else if (((Input.GetAxis("360_TriggerL") > 0.001 && Input.GetAxis("360_TriggerR") > 0.001) || Input.GetKeyDown(KeyCode.Space)) && powerupscriptdeuxieme.BeakyGotAPowerUp == true && powerupscriptpremier.BeakyGotAPowerUp == false)
        {
            powerupscriptdeuxieme.BeakyGotAPowerUp = false;
            powerupscriptdeuxieme.ActivatePowerUp();
            print("J'utilise le powerup #1!");
        }

        // Triggers séparés
//		if (Input.GetAxis ("360_TriggerL") > 0.001){
//			print ("Je pèse sur le trigger gauche!!");
//		}
//
//		if (Input.GetAxis ("360_TriggerR") > 0.001) {
//			print ("Je pèse sur le trigger droit!!");
//		}
    }