public EngineCommandResult Execute(IEngineCommand c) { var aec = (AshyCore.EngineAPI.EngineCommands.AddEntity)c; var res = LevelCmdHelper.InitEntity(aec.Entity); return(res); }
EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c) { var aec = (AshyCore.EngineAPI.EngineCommands.AddEntity)c; Engine.I.Level.Spawn(aec.Entity); return(EngineCommandResult.Success); }
public EngineCommandResult Execute(IEngineCommand c) { Engine.I.DestroyWorld(); Memory.Collect(showLog: true); return(EngineCommandResult.Success); }
internal void Execute(IEngineCommand command) { EngineCommandContext ctx = new EngineCommandContext { Engine = this, ConnectionManager = this._connectionManager }; command.Execute(ctx); }
public EngineCommandResult Execute(IEngineCommand c) { Memory.Collect(showLog: true); Engine.I.RenderTechnique?.Free(); Engine.I.Status = EngineStatus.ReadyToUse; return(EngineCommandResult.Success); }
public void CreateCommand(IEngineCommand command) { var commandExists = this.commands.Any(s => s.Id == command.Id); if (commandExists) { throw new Exception("This command already exists!"); } this.commands.Add(command); }
public EngineCommandResult Execute(IEngineCommand c) { if (Executers == null) { throw new NullReferenceException(nameof(c)); } IEngineCommandHandler executer; Executers.TryGetValue(c.Type, out executer); return(executer?.Execute(c) ?? EngineCommandResult.Success); }
public EngineCommandResult Execute(IEngineCommand c) { var ll = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c; var scene = new RenderingScene(ll.LoadingLevel.Entities); var isLoaded = Engine.I.RenderTechnique.Init(scene); if (isLoaded) { Engine.I.Status = EngineStatus.LoadedWorld; } return(isLoaded ? EngineCommandResult.Success : EngineCommandResult.Failed); }
public EngineCommandResult Execute(IEngineCommand c) { var ll = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c; var res = EngineCommandResult.Success; Engine.I.CreateWorld(); foreach (var entity in ll.LoadingLevel.Entities) { res = LevelCmdHelper.InitEntity(entity).Worst(res); } return(res); }
public EngineCommandResult Execute(IEngineCommand c) { CoreAPI.I.Game.Level.Entities .Where(e => e.HasComponent(ComponentType.Geom)) .Select(e => e.Get <GeomComponent>(ComponentType.Geom).Mesh) .ForEach(m => m.Free()); var result = LevelCommandsHelper.CollectResources(); var aliveMeshes = Mesh.HoldingData.Count(h => h.IsAlive); var aliveMeshesData = BufferDataDesctiption.HoldingData.Count(h => h.IsAlive); Engine.I.Log.Info($"Alive meshes: {aliveMeshes}, Alive meshes data: {aliveMeshesData}"); return(result); }
private EngineCommandResult ProcessCommand(IEngineCommand c) { var res = EngineCommandResult.Success; foreach (var h in _handlers) { res = h.Execute(c); Proxy.Core.Log.Info("[Proxy Command Processor]-- " + h.GetType().Name + " -- Command status: " + res); if (res == EngineCommandResult.CriticalFailed) { break; } } return(res); }
EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c) { try { var ll = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c; Engine.I.Level = ll.LoadingLevel; Engine.I.Level.Load(); } catch (Exception e) { GameAPI.I.Core.Log.Error("--- Load level command failed in AshyGame module ---", e); #if DEBUG throw; #else return(EngineCommandResult.CriticalFailed); #endif } return(EngineCommandResult.Success); }
public void AddCommand(IEngineCommand c) { ActiveCommands.Enqueue(c); }
EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c) { Engine.I.Level = null; return(EngineCommandResult.Success); }
public EngineCommandResult Execute(IEngineCommand c) { return(LevelCommandsHelper.CollectResources()); }