Exemple #1
0
        public static void Main()
        {
            TurnQueue = new TurnQueue();
            int seed = (int)DateTime.UtcNow.Ticks;

            Random = new DotNetRandom(seed);
            string bitmap = "terminal8x8.png";
            string Title  = $"RPG - Poziom {Facade._mapLevel}";

            _mainConsole         = new RLRootConsole(bitmap, _screenWidth, _screenHeight, 8, 8, 1f, Title);
            _mapConsole          = new RLConsole(_mapWidth, _mapHeight);
            _logConsole          = new RLConsole(_logWidth, _logHeight);
            _statConsole         = new RLConsole(_statWidth, _statHeight);
            _lootConsole         = new RLConsole(_lootWidth, _lootHeight);
            _mainConsole.Update += OnRootConsoleUpdate;
            _mainConsole.Render += OnRootConsoleRender;
            _mapConsole.SetBackColor(0, 0, _mapWidth, _mapHeight, Colors.FloorBG);
            _mapConsole.Print(1, 1, "Mapa", Colors.TextH);
            _statConsole.SetBackColor(0, 0, _statWidth, _statHeight, Palette.Red2);
            _statConsole.Print(1, 1, "Statystyki", Colors.TextH);
            _lootConsole.SetBackColor(0, 0, _lootWidth, _lootHeight, Palette.Wood);
            _lootConsole.Print(1, 1, "Ekwipunek", Colors.TextH);
            soundplayer.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "\\muzyka.wav";
            soundplayer.PlayLooping();
            facade.InitGame();
            _mainConsole.Run();
        }
    public void Start()
    {
        if (BattleMode == BattleModes.Auto)
        {
            if (academy.HasTrainingBrain)
            {
                battleMode = BattleModes.Training;
            }
            else if (academy.HasTrainedBrain && !academy.HasPlayerBrain)
            {
                battleMode = BattleModes.DataCollection;
            }
            else
            {
                battleMode = BattleModes.SingleBattle;
            }
        }

        queue    = new TurnQueue(this);
        nBattles = 0;
        foreach (DecisionLog log in decisionLogs)
        {
            log.ClearLog();
        }
        if (BattleMode != BattleModes.Training)
        {
            StartBattle();
        }
    }
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        prefab        = Resources.Load <QueueObject>("Prefabs/QueueObject");
        queuedObjects = new List <QueueObject>();
    }
Exemple #4
0
 private void Awake()
 {
     if (instance != null)
     {
         GameObject.DestroyImmediate(instance.gameObject);
         Debug.LogError("additional weatherqueue found. deleting the older one");
     }
     instance = this;
     // Debug.Log("defined instance");
 }
        public async void AdvanceTurn()
        {
            //get the next player id
            var turn = TurnQueue.Find(CurrentPlayerTurn);

            if (turn.Next == null)
            {
                CurrentPlayerTurn = TurnQueue.First.Value;
            }
            else
            {
                CurrentPlayerTurn = turn.Next.Value;
            }

            //reset counts
            Roll         = 0;
            RollAttempts = 0;
            //notify players
            await SendMessageAsync(new GameMessageUnity(RoomID, "NEXTTURN", CurrentPlayerTurn.ToString()))
            .ConfigureAwait(false);
        }
Exemple #6
0
    private void Awake()
    {
        if (main == null)
        {
            main = this;
        }
        else if (main != this)
        {
            Destroy(gameObject);
        }

        actors = new List <Actor>();

        if (!isDebug)
        {
            Destroy(debugGrid);
            mapData     = GameObject.FindGameObjectWithTag("Data").GetComponent <ScenarioData>();
            mapData.map = Instantiate <GameObject>(mapData.map);
            isMulti     = mapData.isMulti;
            team        = mapData.myTeam;
            grid        = mapData.map.GetComponent <Grid>();

            for (int i = 0; i < Math.Min(mapData.levelData.spawnpointTeam1.Count, mapData.ActorRole1.Count); i++)
            {
                if (!isMulti || team == 1)
                {
                    actors.Add(new Player(mapData.ActorRole1[i], mapData.levelData.spawnpointTeam1[i], 1));
                }
                else
                {
                    actors.Add(new MPlayer(mapData.ActorRole1[i], mapData.levelData.spawnpointTeam1[i], 1));
                }
            }
            for (int i = 0; i < Math.Min(mapData.levelData.spawnpointTeam2.Count, mapData.ActorRole2.Count); i++)
            {
                if (!isMulti)
                {
                    actors.Add(new AIPlayer(mapData.ActorRole2[i], mapData.levelData.spawnpointTeam2[i], 2));
                }
                else if (isMulti && team == 2)
                {
                    actors.Add(new Player(mapData.ActorRole2[i], mapData.levelData.spawnpointTeam2[i], 2));
                }
                else
                {
                    actors.Add(new MPlayer(mapData.ActorRole2[i], mapData.levelData.spawnpointTeam2[i], 2));
                }
            }
        }
        else
        {
            debugGrid.SetActive(true);
            grid = debugGrid.GetComponent <Grid>();
            actors.Add(new Player("Ninja", new Vector3Int(0, 0, 0), 1));
            actors[0].MoveRadius         = 35;
            actors[0].moveAnimationSpeed = 4f;
            team = 1;
        }
        GetWorldTiles();

        for (int i = 0; i < actors.Count; i++)
        {
            actors[i].Idx = i;
        }

        if (team == 1)
        {
            turnQueue = new TurnQueue(actors);
        }

        if (isMulti)
        {
            teamName = new string[] {
                Client.Instance.players.Where(x => x.isHost).ToList()[0].name,
                Client.Instance.players.Where(x => !x.isHost).ToList()[0].name
            };
        }

        waiting = null;
    }
 public void StartNewTurn()
 {
     queue_ = new TurnQueue(this, allCharacters_.ToList());
     turn_++;
 }
 public TurnNotifier(TurnQueue queue)
 {
     queue_        = queue;
     wasWaitStage_ = queue.IsWaitStage;
 }