private void Start() { fb = GetComponent <FieldBehaviour>(); controller = new GameInputProcessor(fb); var savedExePath = PlayerPrefs.GetString(PrefKeyBotExe, ""); if (savedExePath != "") { botExePath = savedExePath; manager = new BotManager(botExePath, controller, botIndex); botExePathText.text = System.IO.Path.GetFileName(botExePath); } fb.ResetField += () => { manager?.Dispose(); }; fb.Initialized += () => { if (!string.IsNullOrEmpty(botExePath)) { manager = new BotManager(botExePath, controller, botIndex); manager.Launch(fb); } }; }
public void Launch(FieldBehaviour fb) { this.fb = fb; field = fb.field; foreseeField = field.Clone(); fb.NewPiece += OnNewPiece; fb.PieceSpawned += OnPieceSpawned; var start = new ProcessStartInfo { FileName = pathToExecutable, WorkingDirectory = System.IO.Path.GetDirectoryName(pathToExecutable), UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true }; process = Process.Start(start); Status = BotStatus.Initializing; stdout = process.StandardOutput; stdin = process.StandardInput; stderr = process.StandardError; runner = Run(); }
// Start is called before the first frame update void Start() { gameStateUpdateMapping.Add(GameStates.Acting, ActingUpdate); gameStateUpdateMapping.Add(GameStates.Pause, PauseUpdate); gameStateUpdateMapping.Add(GameStates.Planning, PlanningUpdate); Field = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>(); }
public MoveCommand(TileBehaviour to, GameObject source, float speed = 1) { _to = to; IsComplete = false; _field = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>(); gameObject = source; _speed = speed; }
// Start is called before the first frame update void Start() { gameStateUpdateMapping = new Dictionary <GameStates, Action>(); gameStateUpdateMapping.Add(GameStates.Acting, ActUpdate); gameStateUpdateMapping.Add(GameStates.Pause, PauseUpdate); gameStateUpdateMapping.Add(GameStates.Planning, PlanningUpdate); Field = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>(); GameStateSwitcher gss = Camera.main.GetComponent <GameStateSwitcher>(); gss.StateSwitched.AddListener(OnStateSwitched); }
public Persist(SqlDbType dbtype, FieldBehaviour behaviour = FieldBehaviour.common, string dbfield = "") { _dbtype = dbtype; _behaviour = behaviour; _field = dbfield; }
public void SetBehaviour(FieldBehaviour behaviour) { _behaviour = behaviour; }
public void ApplyControl(FieldBehaviour fb) { }
void Start() { Field = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>(); }