Exemple #1
0
 public void Hit(PlayerController killer, string weapon)
 {
     if (KartState.UsingWeapon != null)
     {
         KartState.UsingWeapon.OnHit();
     }
     if (KartState.TempBuffs["SingleHitProtection"] == 1)
     {
         KartState.SetInvincibility(1.75f);
         KartState.TempBuffs["SingleHitProtection"] = 0;
     }
     else if (KartState.IsInvincible() == false)
     {
         Die(killer, weapon);
     }
 }
Exemple #2
0
    IEnumerator Transparence()
    {
        kc.numberOfJump = 0;
        //clignotment, invincibilité temporaire
        if (!kart_state.IsInvincible())
        {
            kart_state.SetInvincibility(4);
        }
        foreach (string w in wheels.Keys)
        {
            wheels [w].GetComponent <Renderer>().enabled = false;
        }
        float time         = 0f;
        float last_time    = 0f;
        float clignotement = 0.3f;

        foreach (GameObject w in smoke)
        {
            w.SetActive(false);
        }
        while (time < 4f)
        {
            yield return(new WaitForSeconds(0.1f));

            time += 0.1f;
            if ((time - last_time) > clignotement)
            {
                last_time     = time;
                clignotement /= 2;
                foreach (string w in wheels.Keys)
                {
                    wheels [w].GetComponent <Renderer>().enabled = !wheels [w].GetComponent <Renderer>().enabled;
                }

                /*foreach(GameObject w in smoke){
                 *      w.SetActive(!w.activeSelf);
                 * }*/
            }
        }
        foreach (string w in wheels.Keys)
        {
            wheels [w].GetComponent <Renderer>().enabled = true;
        }
        foreach (GameObject w in smoke)
        {
            w.SetActive(true);
        }
    }