/// <summary> /// Creates a bullet for all players. /// </summary> /// <param name="player">The player who shot the bullet.</param> public void CreateBullet(PlayerManager player) { byte id = CreateSyncable((byte)GameManager.bulletLayer, out NetSyncComponent ncs); Actor bulletActor = ComponentFactory.CreatePreparedBullet(id); bulletActor.GetComponent <Transform2>().WorldPosition = player.Actor.GetComponent <Transform2>().WorldPosition + player.GetLookingVector(); NetSyncComponent.TriggerClientEvent("CB", id); Weapon weapon = player.Equip.ActiveWeapon; Bullet bullet = bulletActor.AddComponent <Bullet>(); bullet.Set(weapon.BulletVelocity, player); }
public void CreateBullet(byte id) { ComponentFactory.CreatePreparedBullet(id); }