Immortality









How do I use Immortality
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PlayerControl.cs Copy
115     public void GetDamage(int damage = 1)
116     {
117         if (immortal)
118             return;
119
120         immortal = true;
121
122         lifeCurrent-= damage;
123
124         ui.ShowLives(lifeCurrent);
125
126         if (lifeCurrent > 0)
127         {
128             sounds.PlaySoundsPlayer(1);
129             StartCoroutine("Immortality");
130         }
131         else
132         {
133             sounds.PlaySoundsPlayer(2);
134             Die();
135         }
136     }
File name: PlayerControl.cs Copy
138     public void Die()
139     {
140         StopCoroutine("Immortality");
141
142         immortal = false;
143
144         transform.gameObject.SetActive(false);
145     }
File name: PlayerControl.cs Copy
196     IEnumerator Immortality()
197     {
198         for (int i = 0; i < 8; i++)
199         {
200             mesh.enabled = !mesh.enabled;
201             yield return new WaitForSeconds(immortalTime);
202         }
203         mesh.enabled = true;
204         immortal = false;
205     }

Immortality 104 lượt xem

Gõ tìm kiếm nhanh...