private void Update() { transform.localPosition += (direction * speed * Time.deltaTime); cDist = Vector3.Distance(transform.localPosition, targetPos); if (cDist < 0.1f) { //hit FX.Emit(transform.position, transform.rotation, FX.VFX.ShadowBoltHit, 50); Barbarian.FindBarbarian().Damage(10); ParticleSystem ps = GetComponentInChildren <ParticleSystem>(); Transform tr = GetComponentInChildren <TrailRenderer>().transform; ParticleSystem.EmissionModule em = ps.emission; em.enabled = false; tr.SetParent(null, true); ps.transform.SetParent(tr, true); GetComponentInChildren <VLight>().Hide(); Destroy(tr.gameObject, 0.5f); Destroy(gameObject); } }
public override void Kill() { cell.occupant = 0; cell.enemy = null; Game.RemoveEnemy(this); anim.PlayAnimation("Warlock_Death"); FX.Emit(transform.localPosition + Game.HALF_Y, Quaternion.identity, FX.VFX.Bats, 15); StartCoroutine(DelayedDestruction(anim.GetClipLength("Warlock_Death"))); }
private IEnumerator DelayedDestruction(float time) { float t = 0.0f; while (t < time) { t += Time.deltaTime; yield return(null); } FX.Emit(transform.localPosition + Game.HALF_Y, Quaternion.identity, FX.VFX.SlimeDeath, 30); HandleMoney(); Destroy(gameObject); }
public float VisualTurn(BARBARIAN_MOVE_TYPE type, Cell c, int turn) { // Handle animations, effects etc. // Lerp to new cell. float r = Game.BARBARIAN_TIMER; switch (type) { case BARBARIAN_MOVE_TYPE.MOVE: anim.PlayAnimation("Barbarian_Move"); StartCoroutine(Move(c.position, 0.5f)); StartCoroutine(MoveCamera(c.position + camOffset, 0.5f)); StartCoroutine(Rotate(Helper.QDIR(c.position - transform.position), 0.1f)); break; case BARBARIAN_MOVE_TYPE.ATTACK: anim.PlayAnimation("Barbarian_Attack1"); StartCoroutine(Rotate(Helper.QDIR(c.position - transform.position), 0.1f)); break; case BARBARIAN_MOVE_TYPE.SPELL_STOMP: anim.PlayAnimation("Barbarian_Stomp"); FX.Emit(transform.localPosition + (Game.HALF_Y * 0.01f), Quaternion.identity, FX.VFX.Stomp, 1); break; case BARBARIAN_MOVE_TYPE.FINISH: //Here goes jump down animations and map lerps break; default: r = 0.0f; break; } return(r); }
public void HandleMoney() { FX.Emit(transform.localPosition + Vector3.up, Quaternion.identity, FX.VFX.Coins, value); barbarian.AddMoney(value); }