Наследование: MonoBehaviour
Пример #1
0
    private void OnMapGenerationDone(Map map)
    {
        GameObject      game  = new GameObject("GameModel");
        WorldSimulation model = game.AddComponent <WorldSimulation>();

        model.Init(map);
    }
Пример #2
0
 void Start()
 {
     _game = gameObject.GetComponent<MainProxy>();
     _sim = gameObject.GetComponent<WorldSimulation>();
     _uiHook = FindObjectOfType<CheatMenuHook>();
     _uiHook.hideContent();
 }
Пример #3
0
    public void Update(WorldSimulation Model, GameEventHandler Handler)
    {
        switch (State)
        {
        case ExecutionState.ZoomIn:
            if (!CameraHandler.IsMoving)
            {
                Execute(Model, Handler);
                State = ExecutionState.Zoomed;
            }
            break;

        case ExecutionState.Zoomed:
            if (CameraCurrentFocusTime < CameraFocusTime)
            {
                CameraCurrentFocusTime += Time.deltaTime;
            }
            else
            {
                State = ExecutionState.ZoomOut;
                CameraHandler.ReturnToDefaultView();
            }
            break;

        case ExecutionState.ZoomOut:
            if (!CameraHandler.IsMoving)
            {
                ExecutionDone(Handler);
            }
            break;
        }
    }
Пример #4
0
 public virtual void InitExecution(WorldSimulation Model)
 {
     CameraCurrentFocusTime = 0f;
     if (CameraHandler == null)
     {
         CameraHandler = Camera.main.GetComponent <CameraHandler>();
     }
     State = ExecutionState.ZoomIn;
 }
Пример #5
0
    public override void InitExecution(WorldSimulation Model)
    {
        base.InitExecution(Model);

        List <Region> candidates = Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null).ToList();

        Capital = candidates[Random.Range(0, candidates.Count)];
        CameraHandler.MoveToFocusRegion(Capital);
    }
Пример #6
0
        public void initialize(MainProxy game)
        {
            _game = game;
            onPoinerExit();

            _targetInstance = Instantiate(target);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            _seedTargetInstance = Instantiate(seedTarget);
            _seedTargetInstance.transform.position = new Vector3(-100f, 100f);

            _sim = FindObjectOfType <WorldSimulation>();
        }
Пример #7
0
        public void initialize(MainProxy game)
        {
            _game = game;
            onPoinerExit();

            _targetInstance = Instantiate(target);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            _seedTargetInstance = Instantiate(seedTarget);
            _seedTargetInstance.transform.position = new Vector3(-100f, 100f);

            _sim = FindObjectOfType<WorldSimulation>();
        }
Пример #8
0
        public GTA2Game(string mapName, string styleName)
        {
            map = new Map.Map(mapName, styleName);
            map.CalcCoord();

            _physics = new WorldSimulation(map);

            sprites = new Sprites();
            GameObject.spriteAtlas = sprites;
            pedList = new List <Pedestrian>();
            Pedestrian ped = new Pedestrian(new Vector3(65, 178, 5));

            pedList.Add(ped);
            _physics.AddPed(ped);

            debugDraw = false;
        }
Пример #9
0
    public override void InitExecution(WorldSimulation Model)
    {
        base.InitExecution(Model);

        NewProvince = Candidates[Random.Range(0, Candidates.Count)];
        List <Nation> nationCandidates = new List <Nation>();

        foreach (Region r in NewProvince.AdjacentRegions)
        {
            if (r.Nation != null && !nationCandidates.Contains(r.Nation))
            {
                nationCandidates.Add(r.Nation);
            }
        }
        CapturingNation = nationCandidates[Random.Range(0, nationCandidates.Count)];

        CameraHandler.MoveToFocusRegion(NewProvince);
    }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            simulation = new WorldSimulation();
            drawing    = new DrawService(simulation.WorldSize);
            sw         = Stopwatch.StartNew();
            simulation.RunSimulation();
            sw.Stop();

            var time = sw.ElapsedMilliseconds;

            simulation.statistic.AlgorithmTime = time;

            var table = drawing.ConstructDataTable(simulation.allAgents);

            this.worldView.DataSource = table;
            for (int i = 0; i < worldView.ColumnCount; i++)
            {
                worldView.Columns[i].Width = width;
            }

            MessageBox.Show($"Simulation is completed.");
        }
Пример #11
0
 public GameEventHandler(WorldSimulation model)
 {
     Model = model;
 }
Пример #12
0
 protected abstract void Execute(WorldSimulation Model, GameEventHandler Handler);
Пример #13
0
        void Start()
        {
            state = GameState.AWAITING_CONNECT;

            _connection = gameObject.AddComponent<Connection>();
            _loginMenu = gameObject.AddComponent<LoginScreenLogic>();
            _cheatMenu = gameObject.AddComponent<CheatMenuLogic>();
            _simulation = gameObject.AddComponent<WorldSimulation>();
            _abil = FindObjectOfType<AbilitiesMenuHook>();
            _abil.hide ();
        }
Пример #14
0
    protected override void Execute(WorldSimulation Model, GameEventHandler Hanlder)
    {
        Nation newNation = Model.CreateNation(Capital);

        Model.AddLog("A new nation " + newNation.Name + " has emerged. It has called its capital " + newNation.Capital.Name + ".");
    }
Пример #15
0
 public override int GetProbability(WorldSimulation Model)
 {
     return((int)(Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null).Count() * 0.3f));
 }
Пример #16
0
 public abstract int GetProbability(WorldSimulation Model);
Пример #17
0
 protected override void Execute(WorldSimulation Model, GameEventHandler Handler)
 {
     Model.CaptureRegion(CapturingNation, NewProvince);
     Model.AddLog("The nation " + CapturingNation.Name + " has expanded. It has called its new province " + NewProvince.Name);
 }
Пример #18
0
 public override int GetProbability(WorldSimulation Model)
 {
     Candidates = Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null && x.AdjacentRegions.Any(y => y.Nation != null)).ToList();
     return(Candidates.Count);
 }