void FirstAttack() { if (attacking) { return; } if (lastAttack1 + attack1Cooldown > Time.time) { return; } attacking = true; sprites.SetTrigger("Attack1"); Mudball newMudball = Instantiate(mudballFab, transform.position, Quaternion.identity) as Mudball; Vector3 direction = (target.position - transform.position).normalized; //Mudball mudball = newMudball.GetComponent<Mudball> (); AudioSource.PlayClipAtPoint(splat, cameraPos.position); newMudball.SetVelocity(direction); newMudball.SetOwner(this); lastAttack1 = Time.time; attacking = false; }
private void Start() { InitializeEntity(); SelfCast = new Heal(gameObject); SelfCast2 = new PoisonCloud(gameObject); AutoTarget = new Fireball(gameObject); AutoTarget2 = new Mudball(gameObject); PosTarget = new MagicMissle(gameObject); anim = GetComponent <Animator> (); curHealth = gameObject.GetComponent <Status> ().getHealth(); blood = transform.Find("Blood").GetComponent <ParticleSystem>(); Dungeon = GameObject.Find("MapGenerator").GetComponent <MakeMap>(); weapon = transform.Find("Weapon"); playerGUI = new PlayerGUI(this); paused = false; Time.timeScale = 1; }