public void blesser(int valeurDegats, GameObject sourceDegats, float facteurRecule) { deplacement.AttaqueInteromput(); deplacement.UnlockPrincesse(); anim.Play("hurt"); sm.playOneShot(PrincesseInpact, Random.Range(0.1f, 0.3f), Random.Range(0.9f, 1.0f)); if (CanPlaySonHurt) { CanPlaySonHurt = false; //sm.playOneShot(PrincesseHurt,Random.Range(0.5f,0.7f),Random.Range(0.85f,1.0f)); sm.playOneShot(PrincesseHurt[Random.Range(0, 2)], 1, Random.Range(0.9f, 1.0f)); StartCoroutine(WaitForSonHurtToPlay()); } Instantiate(ParticleBlood, new Vector3(this.transform.position.x, this.transform.position.y + HauteurParticule, this.transform.position.z), Quaternion.identity); Vector3 directionRecule = (this.transform.position - sourceDegats.transform.position).normalized; rb.velocity = Vector3.zero; rb.AddForce((directionRecule * (reculeHorizontal * facteurRecule)) + (this.transform.up * (reculeVertical * facteurRecule))); vie_courante = Mathf.Max(vie_courante - valeurDegats, 0); GameControl.control.vie = vie_courante; setHudVie(); }
// Update is called once per frame void Update() { if (((InputManager.GetButtonDown("pouvoirGlace") || Input.GetAxisRaw("pouvoirGlace") < -0.75f) && canPower && isUnlocked) && deplacement.canUsePower && GetComponentInParent <PrincesseDeplacement>().isGrounded) { deplacement.canAttack = false; deplacement.AttaqueInteromput(); animator.Play("IcePower"); canPower = false; StartCoroutine(WaitForIceAnim()); } if (running) { var tmp = glaceSol.transform.position; // Debug.Log(tmp.ToString()); compteurFrame++; tmp.y += increment; tmp += (increment * deplacementGlacon); //Debug.Log(tmp.y); if (compteurFrame >= nbFrameMax) { running = false; //Add song explosion des glacons //+ anim destruction ?? } else { glaceSol.transform.position = tmp; } } }