private void Die() { if (isDead) { return; } if (GetComponentInChildren <Virus> () != null) { GetComponentInChildren <Virus> ().Launch(Vector3.up, 90); } if (hostType == HostFigureType.Zombie) { DarkTonic.MasterAudio.MasterAudio.PlaySound("sploosh"); } isDead = true; GameManager.Instance.OnHostFigureDie(this); UpdateAnimationState("Death"); currentMoveTween.Kill(); healthBar.Disable(); transform.parent = null; // Destroy(gameObject); }
void SetHost(HostFigure newHost) { currentHost = newHost; DOTween.Kill(spriteTransform); transform.parent = newHost.visualContainer; spriteTransform.localScale = Vector3.zero; transform.localPosition = Vector3.zero; body.velocity = Vector2.zero; isFlying = false; healthbar.Disable(); }
void Awake() { visualContainer = transform.Find("Container"); m_spriteRenderer = visualContainer.Find("Sprite").GetComponent <SpriteRenderer>(); m_animator = GetComponentInChildren <Animator> (); healthBar = GetComponentInChildren <Healthbar> (); healthBar.Disable(); hostType = HostFigureType.Soldier; UpdateAnimationState("Walk Front"); }