Ejemplo n.º 1
0
 private void Awake()
 {
     if (playerController != null)
     {
         Debug.LogError("Multiple players!");
         enabled = false;
         return;
     }
     player           = gameObject;
     playerController = this;
     if (laser == null)
     {
         Debug.LogError($"Unassigned ShootLaser script!\nat {gameObject.name}");
         enabled = false;
     }
     if (weapon == null)
     {
         Debug.LogError($"Unassigned WeaponHandler script!\nat {gameObject.name}");
         enabled = false;
     }
     input = new MyInputSystem();
     input.PlayerActionControlls.ShootDirection.performed += OnLook;
     input.PlayerActionControlls.Move.performed           += OnMove;
     rigidBody = GetComponent <Rigidbody>();
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        instance = this;

        input = new MyInputSystem();
        if (isHighscoreScene)
        {
            restartButton.gameObject.SetActive(false);
        }
        else
        {
            restartButton.onClick.AddListener(RestartLevel);
            restartButton.onClick.AddListener(AudioHandler.Click);
            input.PlayerActionControlls.Restart.performed += delegate { Press(restartButton); };
        }
        menuButton.onClick.AddListener(LoadMenu);
        menuButton.onClick.AddListener(AudioHandler.Click);

        input.PlayerActionControlls.Move.performed += Move_performed;
        input.PlayerActionControlls.Menu.performed += delegate { Press(menuButton); };

        if (SettingsHandler.cache.highscoreDeletable)
        {
            deleteHighscoresButton.onClick.AddListener(CheckReset);
            deleteHighscoresButton.onClick.AddListener(AudioHandler.Click);
            input.PlayerActionControlls.DeleteHighscores.performed += delegate { Press(deleteHighscoresButton); };
        }
        else
        {
            deleteHighscoresButton.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        if (weaponHandler == null)
        {
            Debug.LogError($"Unassigned WeaponHandler script!\nat {gameObject.name}");
            enabled = false;
        }
        if (arsenal == null)
        {
            Debug.LogError($"Arsenal list null!\nat {gameObject.name}");
            enabled = false;
        }
        try
        {
            weaponNameUI = GameObject.FindWithTag("Weapon Name UI").GetComponent <TextMeshProUGUI>();
        }
        catch (System.NullReferenceException _) { }

        input = new MyInputSystem();
        input.PlayerActionControlls.CycleWeaponRight.started += OnCycleWeaponRight;
        input.PlayerActionControlls.CycleWeaponLeft.started  += OnCycleWeaponLeft;

        weaponHandler.weapon.OnFire += Weapon_OnFire;
        UpdateWeaponName();

        arsenal.ForEach(x => x.HardReset());
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(this);
            return;
        }
        instance      = this;
        numHighscores = PlayerPrefs.GetInt("numHighscores", 0);

        if (!isHighscoreScene)
        {
            nameConfirmButton.onClick.AddListener(delegate { OnSubmit(nameInput.text); });
            nameConfirmButton.onClick.AddListener(AudioHandler.Click);
            nameInput.onEndEdit.AddListener(OnSubmit);

            nameInput.characterValidation = TMP_InputField.CharacterValidation.CustomValidator;
            nameInput.onValidateInput    += ValidateName;

            nameDiscardButton.onClick.AddListener(OnDiscard);
            nameDiscardButton.onClick.AddListener(AudioHandler.Click);

            Time.timeScale = 1f;
        }

        SettingsHandler.ReadToCache();
        difficulty = SettingsHandler.cache.dificulty;

        input = new MyInputSystem();
        input.PlayerActionControlls.Menu.performed    += Menu_performed;
        input.PlayerActionControlls.Restart.performed += Restart_performed;
    }
 override Update(MyInputSystem input, flaot dt)
 {
     if (input.MouseClicked && Bounds.Contains(input.MousePosition))
     {
         Click(this, new EventArgs());
     }
 }
Ejemplo n.º 6
0
 Update(MyInputSystem input, flioat dt)
 {
     foreach (var control in Controls)
     {
         control.Update(input, dt);
     }
 }
Ejemplo n.º 7
0
 private void Awake()
 {
     input = new MyInputSystem();
 }