示例#1
0
        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);
                }
            };
        }
示例#2
0
        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>();
 }
示例#4
0
 public MoveCommand(TileBehaviour to, GameObject source, float speed = 1)
 {
     _to        = to;
     IsComplete = false;
     _field     = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>();
     gameObject = source;
     _speed     = speed;
 }
示例#5
0
    // 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);
    }
示例#6
0
 public Persist(SqlDbType dbtype, FieldBehaviour behaviour = FieldBehaviour.common, string dbfield = "")
 {
     _dbtype    = dbtype;
     _behaviour = behaviour;
     _field     = dbfield;
 }
示例#7
0
 public void SetBehaviour(FieldBehaviour behaviour)
 {
     _behaviour = behaviour;
 }
示例#8
0
 public void ApplyControl(FieldBehaviour fb)
 {
 }
示例#9
0
 public Persist(SqlDbType dbtype, FieldBehaviour behaviour = FieldBehaviour.common, string dbfield = "")
 {
     _dbtype = dbtype;
     _behaviour = behaviour;
     _field = dbfield;
 }
示例#10
0
 void Start()
 {
     Field = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldBehaviour>();
 }