public ModelManagerServer(ITrackableDictionary <uint, IClientProxy> clientProxyDic, IModelManager modelManager, IWorldData worldData) { _clientProxyDic = clientProxyDic; _worldData = worldData; ModelManager = modelManager; AddClientProxyDicListeners(); }
public void Initialize(IWorldData worldData) { sprite = worldData.GetWorldObject(worldObjectId).GetComponent <Sprite>(); movement = worldData.GetWorldObject(worldObjectId).GetComponent <Movement>(); path = pathfinding.FindPath(sprite.TilePosition, goalTilePosition, worldData.GetComponents <ICollisionComponent>()); index = 0; IsDone = false; }
public void Initialize(IWorldData worldData) { IsDone = false; var entity = worldData.GetWorldObject(entityId); if (entity == null) { IsDone = true; } else { var sprite = entity.GetComponent <Sprite>(); emotion.PlayEmotion((int)sprite.TilePosition.X, (int)sprite.TilePosition.Y - 1); } }
public WorldReplication(IWorldData worldData, ICustomCastObject castObject) : base(castObject) { _worldData = worldData; _weaponsReplication = new WeaponsReplication(worldData.WeaponsData, castObject); _charactersReplication = new CharactersReplication(worldData.CharacterData, castObject); _playersReplication = new PlayersReplication(worldData.PlayersData, castObject); _getterDic.Add(nameof(_worldData.WeaponsData), () => _weaponsReplication.WriteWhole()); _setterDic.Add(nameof(_worldData.WeaponsData), obj => _weaponsReplication.Read(obj)); _getterDic.Add(nameof(_worldData.CharacterData), () => _charactersReplication.WriteWhole()); _setterDic.Add(nameof(_worldData.CharacterData), obj => _charactersReplication.Read(obj)); _getterDic.Add(nameof(_worldData.PlayersData), () => _playersReplication.WriteWhole()); _setterDic.Add(nameof(_worldData.PlayersData), obj => _playersReplication.Read(obj)); }
private static void InstantiateWeapons(IWorldData worldData) { IWeaponData axeWeaponData = new WeaponData() { Id = "axe", Damage = 3 }; IWeaponData spellWeaponData = new WeaponData() { Id = "spell", Damage = 1 }; worldData.WeaponsData.Add(axeWeaponData); worldData.WeaponsData.Add(spellWeaponData); }
public IList <WorldObject> LoadEntities(string mapName, IWorldData worldData, IEventRunner eventRunner, EventSwitchHandler eventSwitchHandler) { var entityList = new List <WorldObject>(); var entity = new WorldObject("player", eventSwitchHandler); entity.AddComponent(new Sprite(entity, new SpriteData { Color = Color.White, Height = 19, Width = 15, TextureName = "NPC/main_character", XTilePosition = 2, YTilePosition = 2 }, new Rectangle(0, 0, 16, 19))); entity.AddComponent(new MovementPlayer(entity, 1, new InputKeyboard())); entity.AddComponent(new Animation(entity)); entity.AddComponent(new Collision(entity, worldData)); entity.AddComponent(new ComponentTest(entity, eventRunner, new InputKeyboard(), eventSwitchHandler)); //NPC var entityNpc = new WorldObject("npc", eventSwitchHandler); entityNpc.AddComponent(new Sprite(entityNpc, new SpriteData { Color = Color.White, Height = 19, Width = 15, TextureName = "NPC/rock_trainer", XTilePosition = 4, YTilePosition = 4 }, new Rectangle(0, 0, 16, 19))); entityNpc.AddComponent(new Animation(entityNpc, new AnimationSpinning(16, 20, 400)), 1); entityNpc.AddComponent(new Collision(entityNpc, worldData)); //entityNpc.AddComponent(new EventTriggerEyeContact(entityNpc, eventRunner, new List<IEvent> { new EventEmotion("npc", new EmotionTrainer(eventSwitchHandler)), new EventMovement("npc", new Vector2(8, 8))}, worldData)); entityNpc.AddComponent(new Movement(entityNpc, 1)); entityList.Add(entityNpc); entityList.Add(entity); return(entityList); }
public void Initialize(IWorldData worldData) { position = new Vector2(-100, 40); }
public Collision(IComponentOwner owner, IWorldData worldData) : base(owner) { this.worldData = worldData; }
public EventTriggerEyeContact(IComponentOwner owner, IEventRunner eventRunner, IList <IEvent> events, IWorldData worldData) : base(owner, eventRunner, events) { this.worldData = worldData; }
public ModelManager(IWorldData worldData) { WeaponsModel = new WeaponsModel(worldData.WeaponsData); CharactersModel = new CharactersModel(worldData.CharacterData, WeaponsModel); PlayersModel = new PlayersModel(worldData.PlayersData, CharactersModel); }
public ModelManagerClient(IWorldData worldData) { ModelManager = new ModelManager(worldData); AddPlayerModelsListener(); }
public void LoadContent(IWorldData worldData) { this.worldData = worldData; }