public void CastPush() { AnimateCast(); if (pushTimer <= 0 && SpendMana(push_manaCost)) { pushTimer = pushTime; PushSpell push = Instantiate <PushSpell>(pushPrefab, transform.position + (Vector3)facing * spellDistance, Quaternion.identity); push.transform.right = facing; push.Initialize(facing * 0.12f, this.teamComponent.team, this.power); } }
public void Force() { if (Time.time > (fireRate + lastShot)) { animator.SetBool("isPushing", true); animator.speed = 2.0f; PushSpell pu = Instantiate(pushspell, firingPoint.transform.position, transform.rotation); pu.setPlayerNo(playerNum); AudioManager.instance.PlaySound("push", pu.transform.position); lastShot = Time.time; //animator.SetBool("isCasting", false); } }
virtual public void OnTriggerEnter2D(Collider2D other) { //we hit something. if it is a wall, or on another team, "hit" it and destroy the bullet. TeamComponent otherTeam = other.gameObject.GetComponent <TeamComponent>(); if (otherTeam == null || otherTeam.team != this.teamComponent.team) { //nicely ask the target to take damage other.gameObject.SendMessage("TakeDamage", this.damage, SendMessageOptions.DontRequireReceiver); //damage increased by power in Initialize() PushSpell push = other.gameObject.GetComponent <PushSpell>(); if (push == null) { this.Die(); } } //else ignore the collision }