public override void RangeAttack(Vector3 point) { if (Time.time - lastRangeAttackTime < rangeAttackCooldown) { return; } EnterCombat(); //TODO rework lastRangeAttackTime = Time.time; aimTime = Mathf.Min(aimTime, 1); Vector3 pos = transform.position; pos.y += .7f; GameObject gameObject = (GameObject)Instantiate(Resources.Load("Projectiles/ArrowE"), pos, Quaternion.identity); BaseProjectile projectile = gameObject.GetComponent <BaseProjectile>(); Damage damage = stats.GetDamageValue(false, false, rangeDamageMultiplier); projectile.angleSpeed = 0; projectile.Launch(damage); gameObject.transform.LookAt(point); aimTime = 0; onAimEnd?.Invoke(); }
protected void Attack(List <BaseEntity> enemies) { if (_canAttack) { _canAttack = false; BaseProjectile newProjectile = _projectilePool.GetProjectile(projectile.GetProjectileType()); newProjectile.MoveTo(transform.position); newProjectile.transform.SetParent(transform); newProjectile.Launch(enemies[0]); StartCoroutine(AttackCooldown(GetCooldown())); } }
void SpawnProjectile(GameObject proj, Vector3 target) { Vector3 pos = transform.position; pos.y = target.y; GameObject gameObject = Instantiate(proj, pos, Quaternion.identity); gameObject.transform.LookAt(target); BaseProjectile projectile = gameObject.GetComponent <BaseProjectile>(); projectile.angleSpeed = 1 - aimTime; projectile.ignorePlayer = true; projectile.Launch(stats.GetDamageValue()); }