public void AddProjectile(string nameMissile, float toX, float toY, bool isServerOnly = false) { Projectile p = new Projectile( Owner.X, Owner.Y, (int)LineWidth, Owner, new Target(toX, toY), this, ProjectileSpeed, (int)_rafManager.GetHash(nameMissile), ProjectileFlags != 0 ? ProjectileFlags : Flags ); _game.Map.AddObject(p); if (!isServerOnly) { _game.PacketNotifier.notifyProjectileSpawn(p); } }
public Projectile( float x, float y, int collisionRadius, Unit owner, Target target, Spell originSpell, float moveSpeed, string projectileName, int flags = 0, uint netId = 0 ) : base(x, y, collisionRadius, 0, netId) { _originSpell = originSpell; _moveSpeed = moveSpeed; Owner = owner; Team = owner.Team; ProjectileId = (int)_rafManager.GetHash(projectileName); if (!string.IsNullOrEmpty(projectileName)) { JObject data; if (!_rafManager.ReadSpellData(projectileName, out data)) { _logger.LogCoreError("Couldn't find projectile stats for " + projectileName); return; } VisionRadius = _rafManager.GetFloatValue(data, "SpellData", "MissilePerceptionBubbleRadius"); } _flags = flags; ObjectsHit = new List <GameObject>(); Target = target; if (!target.IsSimpleTarget) { ((GameObject)target).incrementAttackerCount(); } owner.incrementAttackerCount(); }
/// <returns>spell's unique ID</returns> public int getId() { return((int)_rafManager.GetHash(_spellName)); }