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); }
void Update() { if ((directionInput < 0) && (facingRight)) { Flip(); } if ((directionInput > 0) && (!facingRight)) { Flip(); } groundCheck = true; if (isGrounded == true) { extraJumps = extraJumpsValue; } if (AttackTimer > 0f) { AttackTimer -= Time.deltaTime; } //KnifeButton if (KnifeValue == 2) { KnifeActive.SetActive(true); KnifeActive1.SetActive(true); KnifeActive2.SetActive(false); NoKnifeActive.SetActive(false); NoKnifeActive1.SetActive(false); NoKnifeActive2.SetActive(true); } if (KnifeValue == 1) { KnifeActive.SetActive(true); KnifeActive1.SetActive(false); KnifeActive2.SetActive(false); NoKnifeActive.SetActive(false); NoKnifeActive1.SetActive(true); NoKnifeActive2.SetActive(true); } if (KnifeValue == 0) { KnifeActive.SetActive(false); KnifeActive1.SetActive(false); KnifeActive2.SetActive(false); NoKnifeActive.SetActive(true); NoKnifeActive1.SetActive(true); NoKnifeActive2.SetActive(true); } //AnimationRunUpdate if (ButtonsScript.PauseActive == false && dead == false && isRun == true && isGrounded == true) { anim.SetBool("isRunning", true); } if (ButtonsScript.PauseActive == false && dead == false && isRun == false && isGrounded == true) { anim.SetBool("isRunning", false); } //Animation Pause if (ButtonsScript.PauseActive == true && isGrounded == true) { anim.Play("Stop"); anim.SetBool("isRunning", false); } }