private void Die() { anim.SetTrigger("Die"); player.TogglePlayable(false); Time.timeScale = 1f; CardIndex enemyCard = new CardIndex(enemyID, realImg, inGameImg, encounterLocal, enemyBehavior, enemyName, realInfo); BestiaryElements.AddCardEnemy(enemyCard); PontuationCounter.AddScore(3000); }
public void Die() { Fire.Play(); destination += Vector3.down * 50; speed = 12; CardIndex enemyCard = new CardIndex(enemyID, realImg, inGameImg, encounterLocal, enemyBehavior, enemyName, realInfo); BestiaryElements.AddCardEnemy(enemyCard); PontuationCounter.AddScore(3000); }
void Update() //método padrão do unity que roda no início de cada frame { if (life <= 0) //verifica se o inimigo está morto { if (DieDestroy) { if (!stuned) // se ele não estiver atordoado... { Destroy(this.gameObject); //destrua esse objeto } else //se ele estiver atordoado (pra gente poder ver o inimigo saindo voando depois de tomar o último hit) { HitF = Instantiate(hiteffect, transform.position, transform.rotation).GetComponent <SpriteRenderer>(); //instanciar o efeito visual de dano HitF.color = new Color(1f, stun, stun, 1f); //escolher uma cor para o efeito cada vez mais avermelhada de acordo com o tempo de atordoamento restante HitF.gameObject.transform.localScale = new Vector3(1 / (stun + 0.1f) + 6f, 1 / (stun + 0.1f) + 6f, 1f); // ir aumentando o tamanho do efeito visual this.gameObject.GetComponent <Collider2D>().enabled = false; // desabilitar os colisores do inimigo, para ele não bater em nada } } else { if (!stuned) { GameEvents.ScreamEvent("EnemyKilled"); CardIndex enemyCard = new CardIndex(enemyID, realImg, inGameImg, encounterLocal, enemyBehavior, enemyName, realInfo); BestiaryElements.AddCardEnemy(enemyCard); PontuationCounter.AddScore(500); a.PlaySound("die"); } SetStuned(5); life = 0; } } else { if (stuned && stun <= 0) { stuned = false; } } if (stun > 0.0f && (DieDestroy || life > 0)) //se o inimigo estiver atordoado.. { stun -= Time.deltaTime; //diminuir o tempo restante de atordoamento, com base em quanto tempo passa entre cada frame } else if (DieDestroy || life > 0) //se ele não estiver atordoado { stuned = false; //então ele não está atordoado. (não dá pra ser verdadeiro e falso ao mesmo tempo ainda.) } }
public void GetAllCombinations() { char[] delimit = new char[] { ',' }; string[] splited = str.Split(delimit); if (TA.Contains(str) || splited[0] == splited[1]) { pontuation += 1; TA.Remove(str); GameEvents.ScreamEvent("CorrectAwnser"); } else { GameEvents.ScreamEvent("WrongAwnser"); } PontuationCounter.AddScore(pontuation * 1500); }
public void takedamage(int dmg, Vector2 knockback) //método que faz o inimigo tomar dano, dmg = dano recebido (inteiro) e Knockback = direção e intensidade da repulsão (Vector2(x, y)) { if (life > 0 || (life <= 0 && !DieDestroy)) //verifica se o inimigo é capaz de receber dano de alguma forma { stun = hitstun; //faz com que o inimigo tenha o tempo de atordoamento ativado stuned = true; //ativa o status de atordoado if (life > dmg || (life <= 0 && !DieDestroy)) // se o inimigo não for morrer ao tomar esse dano... { if (hiteffect != null) { Instantiate(hiteffect, transform.position, transform.rotation); // instanciar o efeito visual para tomar dano não-letal } if (a != null) { a.PlaySound("dmg"); } life -= dmg; //diminuir a vida do inimigo } else //se ele for morrer ao receber esse dano { if (a != null) { a.PlaySound("die"); } life = 0; // duh, vida = 0 GameEvents.ScreamEvent("EnemyKilled"); //diga pra todo mundo que um inimigo morreu CardIndex enemyCard = new CardIndex(enemyID, realImg, inGameImg, encounterLocal, enemyBehavior, enemyName, realInfo); BestiaryElements.AddCardEnemy(enemyCard); PontuationCounter.AddScore(500); } this.gameObject.GetComponent <Rigidbody2D>().velocity += knockback * KnBackIntensity; } }
public void AdcthisNote() { AnotationManager.AddNote(new Anotation(id, sp, txt)); PontuationCounter.AddScore(1000); }