Exemple #1
0
 public static void KillBossTP(bossTeleport perso)
 {
     Destroy(perso.gameObject);
 }
    private void Update()
    {
        // Read the inputs.
        //bool crouch = Input.GetKey(KeyCode.LeftControl);
        float h = CrossPlatformInputManager.GetAxis("Horizontal");

        //float primaryAttack = Input.GetAxis("Fire1");

        // Pass all parameters to the character control script.
        m_Character.Move(h, false, m_Jump);
        m_Jump = false;

        if (CrossPlatformInputManager.GetButtonDown("Fire1") || CrossPlatformInputManager.GetAxis("Fire1") != 0)
        {
            m_Character.UseWeapon();
        }

        if (Input.GetAxisRaw("Fire3") != 0)
        {
            if (m_isAxisInUse == false)
            {
                m_Character.Viser();
                m_isAxisInUse = true;
            }
        }
        if (Input.GetAxisRaw("Fire3") == 0)
        {
            if (m_isAxisInUse)
            {
                m_Character.Viser();
            }

            m_isAxisInUse = false;
        }

        if (CrossPlatformInputManager.GetButtonDown("WeaponSelectUp"))
        {
            m_Character.WeaponSwitch(true);
        }

        if (CrossPlatformInputManager.GetButtonDown("WeaponSelectDown"))
        {
            m_Character.WeaponSwitch(false);
        }

        //Rappel pour le grappin
        if (CrossPlatformInputManager.GetAxis("Vertical") != 0)
        {
            if (m_Character.GetComponent <GrappleBeam>().isGrappleAttached)
            {
                m_Character.GetComponent <GrappleBeam>().HandleGrappleLength(CrossPlatformInputManager.GetAxis("Vertical"));
            }
        }

        if (CrossPlatformInputManager.GetButtonDown("UpgradeCheat"))
        {
            if (!upgradeCheatFlag)
            {
                Debug.Log("All upgrade active");
                m_Character.ToggleUpgrade("MorphBall");
                m_Character.gameObject.AddComponent(typeof(MorphBall));

                m_Character.ToggleUpgrade("MorphBomb");

                m_Character.ToggleUpgrade("Missile");
                m_Character.AddWeapon("Missile");

                Debug.Log("missile max 1: " + m_Character.joueurStats.nbMissileMax);

                m_Character.ToggleUpgrade("GrappleBeam");
                m_Character.AddWeapon("GrappleBeam");
                m_Character.gameObject.GetComponent <GrappleBeam>().enabled = true;
                m_Character.gameObject.GetComponent <GrappleBeam>().UpdateGUI(false);

                m_Character.joueurStats.nbMissileMax += 5;
                m_Character.joueurStats.nbMissile     = m_Character.joueurStats.nbMissileMax;
                m_Character.UpdateMissileUI();

                Debug.Log("missile max 2: " + m_Character.joueurStats.nbMissileMax);

                m_Character.joueurStats.vieMax += 100;
                m_Character.joueurStats.vie     = m_Character.joueurStats.vieMax;
                m_Character.UpdateHealthBar();
                upgradeCheatFlag = true;
            }
            else
            {
                Debug.Log("Upgrade cheat deja activé");
            }
        }

        if (CrossPlatformInputManager.GetButtonDown("TriggerAction1"))
        {
            //m_Character.PrintAllUpgrade();
        }

        if (CrossPlatformInputManager.GetButton("Run"))
        {
            m_Character.IsRunning = true;
        }
        else
        {
            m_Character.IsRunning = false;
        }

        if (!m_Jump)
        {
            // Read the jump input in Update so button presses aren't missed.
            m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
        }

        if (Input.GetKeyDown(KeyCode.I))
        {
            m_Character.joueurStats.immortel = !m_Character.joueurStats.immortel;
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            GameMaster.KillJoueur(m_Character);
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            if (GameObject.Find("Boss_Ecrabouilleur") != null)
            {
                boss bo = GameObject.Find("Boss_Ecrabouilleur").GetComponent <boss>();
                bo.CheatLifeBoss();
            }

            if (GameObject.Find("BossTeleporteur") != null)
            {
                bossTeleport boTp = GameObject.Find("BossTeleporteur").GetComponent <bossTeleport>();
                boTp.CheatLifeBoss();
            }
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            if (GameObject.Find("Spawn_Folder") != null)
            {
                AllSpawners all = GameObject.Find("Spawn_Folder").GetComponent <AllSpawners>();
                all.SpawnAllEnnemis();
            }
        }
    }