void Start()
 {
     restartButton.SetActive(false);
     LevelButton.SetActive(false);
     quitButton.SetActive(false);
     ResumeButton.SetActive(false);
     ControlsButton.SetActive(false);
     //Подключение анимации и физики
     rb2d       = GetComponent <Rigidbody2D>();
     anim       = GetComponent <Animator>();
     extraJumps = extraJumpsValue;
     health1.SetActive(true);
     health2.SetActive(true);
     health3.SetActive(true);
     emptyhealth1.SetActive(false);
     emptyhealth2.SetActive(false);
     emptyhealth3.SetActive(false);
     //Health
     playerLayer = this.gameObject.layer;
     enemyLayer  = LayerMask.NameToLayer("Enemy");
     Physics2D.IgnoreLayerCollision(playerLayer, enemyLayer, false);
     rend  = GetComponent <Renderer>();
     color = rend.material.color;
     //Attack
     attackTrigger.enabled = false;
     //Box
     picketFence.enabled = true;
     //KnifeButton
     KnifeActive.SetActive(true);
     KnifeActive1.SetActive(true);
     KnifeActive2.SetActive(true);
     NoKnifeActive.SetActive(false);
     NoKnifeActive1.SetActive(false);
     NoKnifeActive2.SetActive(false);
 }
예제 #2
0
 // Main loop for updating keybinds
 void Update()
 {
     if (selectedButton != null)
     {
         // Iterate through all possible keys
         foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode)))
         {
             // Key found, update binds
             if (Input.GetKeyDown(vKey))
             {
                 // Check if the new key is a key thats already bound
                 foreach (ControlsButton button in allButtons)
                 {
                     if (vKey == Settings.keyBinds[button.getInput()])
                     {
                         Settings.keyBinds[button.getInput()] = KeyCode.None;
                         button.setText("");
                     }
                 }
                 bindKey(vKey, selectedButton);
                 selectedButton = null;
             }
         }
     }
 }
 void Start()
 {
     MainUI         = GameObject.Find("MainUI");
     ControlsUI     = GameObject.Find("ControlsUI");
     ControlsButton = GameObject.Find("Controls Button");
     ControlsButton.GetComponent <Button>().onClick.AddListener(ShowControls);
     ShowMain();
 }
 public void ButtonNoActive()
 {
     quitButton.SetActive(false);
     LevelButton.SetActive(false);
     restartButton.SetActive(false);
     ResumeButton.SetActive(false);
     ControlsButton.SetActive(false);
     PauseActive = false;
 }
 public void ButtonActive()
 {
     quitButton.SetActive(true);
     LevelButton.SetActive(true);
     restartButton.SetActive(true);
     ResumeButton.SetActive(true);
     ControlsButton.SetActive(true);
     PauseActive = true;
     CharController.playerSpeed = 0;
 }
 void DeadIsTrue()
 {
     restartButton.SetActive(true);
     gameObject.SetActive(true);
     quitButton.SetActive(true);
     LevelButton.SetActive(true);
     ResumeButton.SetActive(true);
     ControlsButton.SetActive(true);
     health1.SetActive(false);
     health2.SetActive(false);
     health3.SetActive(false);
     emptyhealth1.SetActive(true);
     emptyhealth2.SetActive(true);
     emptyhealth3.SetActive(true);
 }
예제 #7
0
 private void bindKey(KeyCode key, ControlsButton button)
 {
     Settings.keyBinds[button.getInput()] = key;
     button.setText(key.ToString());
 }
예제 #8
0
 public void updateKeybind(ControlsButton button)
 {
     selectedButton = button;
 }