コード例 #1
0
    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();
    }
コード例 #2
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        deplacement = GameObject.FindGameObjectWithTag("Player").GetComponent <PrincesseDeplacement>();
        deplacement.UnlockPrincesse();
    }