private void Awake() { m_gSettings = Dependencies.Settings; m_gameState = Dependencies.GameState; m_inputManager = Dependencies.InputManager; m_navigation = Dependencies.Navigation; m_console = Dependencies.Console; m_notification = Dependencies.Notification; m_gameServer = Dependencies.GameServer; m_eventSystem = Dependencies.EventSystemManager.GetEventSystem(m_localPlayerIndex); m_gameState.Completed += OnGameCompleted; m_gameState.IsPausedChanged += OnIsPausedChanged; m_gameState.PlayerDefeated += OnPlayerDefeated; m_menuPanel.IsOpenedChanged += OnMenuPanelIsOpenedChanged; m_menuPanel.Action += OnMenuPanelAction; m_settingsPanel.IsOpenedChanged += OnSettingsIsOpenedChanged; m_settingsPanel.Action += OnSettingsPanelAction; m_consolePanel.IsOpenedChanged += OnConsoleIsOpenedChanged; m_consolePanel.Action += OnConsoleAction; m_resultsPanel.IsOpenedChanged += OnResultsIsOpenedChanged; m_resultsPanel.Action += OnResultsPanelAction; }
protected void BeginTest(string mapName, int playersCount, int botsCount, Action callback, int lag = 0) { Assert.DoesNotThrow(() => { string testGamePath = "TestGame"; m_testGame = UnityEngine.Object.Instantiate(Resources.Load <GameObject>(testGamePath)); TestGameInitArgs gameInitArgs = new TestGameInitArgs { MapName = mapName, PlayersCount = playersCount, BotsCount = botsCount }; Dependencies.State.SetValue("Battlehub.VoxelGame.TestGameInitArgs", gameInitArgs); LocalMatchServer localMatchServer = (LocalMatchServer)Dependencies.LocalMatchServer; localMatchServer.Lag = lag; LocalGameServer localGameServer = (LocalGameServer)Dependencies.LocalGameServer; localGameServer.Lag = lag; IVoxelGame voxelGame = Dependencies.GameState; VoxelGameStateChangedHandler started = null; started = () => { voxelGame.Started -= started; callback(); }; voxelGame.Started += started; }); }
private void Awake() { m_gSettings = Dependencies.Settings; m_gameServer = Dependencies.GameServer; m_notification = Dependencies.Notification; m_gameState = Dependencies.GameState; }
private void Awake() { m_engine = Dependencies.MatchEngine; m_unitSelection = Dependencies.UnitSelection; m_targetSelection = Dependencies.TargetSelection; m_inputManager = Dependencies.InputManager; m_map = Dependencies.Map; m_gameState = Dependencies.GameState; if (m_commandsPanel != null) { m_commandsPanel.Move += OnMove; m_commandsPanel.Attack += OnAttack; m_commandsPanel.Cancel += OnCancel; m_commandsPanel.Auto += OnAuto; m_commandsPanel.Wall += OnWall; m_commandsPanel.Bomb += OnBomb; m_commandsPanel.Spawner += OnSpawner; m_commandsPanel.Split += OnSplit; m_commandsPanel.Split4 += OnSplit4; m_commandsPanel.Grow += OnGrow; m_commandsPanel.Diminish += OnDiminish; } // m_commandsPanel.Closed += OnClosed; }
private void Awake() { m_unitSelection = Dependencies.UnitSelection; m_targetSelection = Dependencies.TargetSelection; m_inputManager = Dependencies.InputManager; m_gameState = Dependencies.GameState; m_map = Dependencies.Map; }
protected override void Awake() { base.Awake(); m_settings = Dependencies.Settings; m_gameServer = Dependencies.GameServer; m_gameState = Dependencies.GameState; m_saveReplayPanel.Action += OnSaveReplayAction; UpdateButtonState(); }
private void Awake() { m_map = Dependencies.Map; m_gameState = Dependencies.GameState; m_selection = Dependencies.UnitSelection; m_selection.SelectionChanged += OnSelectionChanged; UpdateCursorsVisibility(); }
private void Awake() { m_gameState = Dependencies.GameState; m_voxelMap = Dependencies.Map; m_selection = Dependencies.UnitSelection; m_targetSelection = Dependencies.TargetSelection; m_minimap = Dependencies.Minimap; m_selection.SelectionChanged += OnUnitSelectionChanged; m_targetSelection.SelectionChanged += OnTargetSelectionChanged; }
private void GetDependencies() { m_gameState = Dependencies.GameState; m_inputManager = Dependencies.InputManager; m_voxelMap = Dependencies.Map; m_factory = Dependencies.VoxelFactory; m_gameView = Dependencies.GameView; m_gameServer = Dependencies.GameServer; m_gSettings = Dependencies.Settings; m_progress = Dependencies.Progress; }
public override void SetIsOpened(bool value, bool raiseEvent = true) { base.SetIsOpened(value, raiseEvent); m_gameState = Dependencies.GameState; m_gameServer = Dependencies.GameServer; Sequence[SaveReplayAction].interactable = !m_gameState.IsReplay && m_gameServer.IsConnected; Sequence[SaveReplayAction].gameObject.SetActive(!m_gameState.IsReplay); m_saveReplayPanel.SetIsOpened(false, raiseEvent); }
public void Unselect(int playerIndex) ///this is player index (not owner index) { if (IsSelected(playerIndex)) { m_selection &= ~(1ul << playerIndex); if (m_selectionOutlines != null) { if (m_gameState == null) { m_gameState = Dependencies.GameState; } if (m_gameState.IsLocalPlayer(playerIndex)) { int localPlayerIndex = m_gameState.PlayerToLocalIndex(playerIndex); cakeslice.Outline outline = m_selectionOutlines.Where(o => o.layerMask == GameConstants.PlayerLayerMasks[localPlayerIndex]).FirstOrDefault(); if (outline != null) { Destroy(outline); } } m_selectionOutlines = null; } if (m_ui != null) { if (m_gameState == null) { m_gameState = Dependencies.GameState; } if (m_gameState.IsLocalPlayer(playerIndex)) { int localPlayerIndex = m_gameState.PlayerToLocalIndex(playerIndex); VoxelUI ui = m_ui.Where(o => o.gameObject.layer == GameConstants.PlayerLayers[localPlayerIndex]).FirstOrDefault(); if (ui != null) { Destroy(ui.gameObject); } } m_ui = null; } OnUnselect(playerIndex); } }
private void Awake() { m_gameState = Dependencies.GameState; m_inputManager = Dependencies.InputManager; m_selection = Dependencies.UnitSelection; m_eventSystemMananger = Dependencies.EventSystemManager; for (int i = 0; i < m_buttons.Length; ++i) { int index = i; m_buttons[i].onClick.AddListener(() => { OnAction(index); }); } }
private void Awake() { m_gameState = Dependencies.GameState; m_settings = Dependencies.Settings; m_inputManager = Dependencies.InputManager; m_voxelMap = Dependencies.Map; MapRect rect = m_voxelMap.MapBounds; Vector3 p0 = m_voxelMap.GetWorldPosition(rect.P0, GameConstants.MinVoxelActorWeight); Vector3 p1 = m_voxelMap.GetWorldPosition(rect.P1, GameConstants.MinVoxelActorWeight); m_allowedRadius = (p1 - p0).magnitude / 2.0f; m_boundsCenter = p0 + (p1 - p0) / 2.0f; }
public MatchUnitControllerBaseCli(IVoxelDataController dataController) { m_dataController = dataController; m_controlledVoxel = m_dataController.ControlledData.VoxelRef; OnSubscribe(); m_dataController.ControlledData.VoxelRefSet += OnVoxelRefSet; m_dataController.ControlledData.VoxelRefReset += OnVoxelRefReset; m_voxelMap = Dependencies.Map; m_voxelFactory = Dependencies.VoxelFactory; m_game = Dependencies.GameState; }
private void Awake() { m_gameState = Dependencies.GameState; if (m_playerColors.Length != m_gameState.MaxPlayersCount) { Debug.LogError("not all m_playerColors defined"); return; } m_primaryMaterials = new Material[m_gameState.MaxPlayersCount]; CreateMaterials(m_primaryMaterial, m_primaryMaterials, true); m_secondaryMaterials = new Material[m_gameState.MaxPlayersCount]; CreateMaterials(m_secondaryMaterial, m_secondaryMaterials, false, m_alpha); }
protected override void Awake() { base.Awake(); m_gameState = Dependencies.GameState; m_minimap = Dependencies.Minimap; m_input = Dependencies.InputManager; m_voxelMap = Dependencies.Map; m_scaler = GetComponentInParent <CanvasScaler>(); m_gameState.Menu += OnMenu; m_gameState.ActionsMenu += OnActionsMenu; m_rtChangeListener = m_selectableMinimap.GetComponent <RectTransformChangeListener>(); m_rtChangeListener.RectTransformChanged += OnMinimapRectTransformChanged; m_hudControlBehavior = m_selectableMinimap.GetComponent <HUDControlBehavior>(); m_hudControlBehavior.Selected += OnMinimapSelected; m_hudControlBehavior.Deselected += OnMinimapDeselected; }
private void Awake() { m_materialCache = Dependencies.MaterialsCache; m_voxelMap = Dependencies.Map; m_gameState = Dependencies.GameState; m_gameState.Started += OnGameStarted; if (m_gameState.IsStarted) { OnGameStarted(); } m_skyColor = Camera.main.backgroundColor; m_skyColor.a = 1.0f; m_groundBaseColor = m_materialCache.GetPrimaryColor(0); m_transparentColor = new Color(0, 0, 0, 0); m_settings = Dependencies.Settings; m_settings.DisableFogOfWarChanged += OnDisableFogOfWarChanged; UpdateColors(); }
private void Init() { m_matchServer = Dependencies.MatchServer; m_gSettings = Dependencies.Settings; m_map = Dependencies.Map; m_game = Dependencies.GameState; m_matchServer.Tick += OnTick; m_matchServer.ReadyToPlayAll += OnReadyToPlayAll; m_matchServer.Ping += OnPing; m_matchServer.Paused += OnPaused; m_matchServer.ConnectionStateChanged += OnConnectionStateChanged; if (!m_matchServer.IsConnectionStateChanging) { if (m_matchServer.IsConnected) { OnConnectionStateChanged(new Error(), new ValueChangedArgs <bool>(false, true)); } } enabled = false; }
private void Awake() { m_gameState = Dependencies.GameState; m_inputManager = Dependencies.InputManager; m_selection = Dependencies.UnitSelection; m_eventSystemMananger = Dependencies.EventSystemManager; m_gameState.ActionsMenu += OnActionsMenu; m_autoCommandsPanel.Action += OnAutoCommandsPanelAction; m_cancelBtn.onClick.AddListener(OnCancel); m_attackBtn.onClick.AddListener(OnAttack); m_moveBtn.onClick.AddListener(OnMove); m_autoBtn.onClick.AddListener(OnAuto); m_bombBtn.onClick.AddListener(OnBomb); m_wallBtn.onClick.AddListener(OnWall); m_spawnButton.onClick.AddListener(OnSpawn); m_splitButton.onClick.AddListener(OnSplit); m_split4Button.onClick.AddListener(OnSplit4); m_growButton.onClick.AddListener(OnGrow); m_diminishButton.onClick.AddListener(OnDiminish); }
private void Start() { m_settings = Dependencies.Settings; m_gameState = Dependencies.GameState; m_voxelFactory = Dependencies.VoxelFactory; m_effectFactory = Dependencies.EffectFactory; OnDebugModeChanged(); m_settings.DebugModeChanged += OnDebugModeChanged; m_materialsCache = Dependencies.MaterialsCache; SetMaterials ( m_materialsCache.GetPrimaryMaterial(m_owner), m_materialsCache.GetSecondaryMaterial(m_owner) ); m_previousAltitude = Altitude; m_previousHeight = Height; StartOverride(); IsEnabled = false; //This is used to enable update method and programmatic animations }
private void Start() { m_gameState = Dependencies.GameState; m_unitSelection = Dependencies.UnitSelection; }
public BombUnitControllerCli(IVoxelDataController dataController) : base(dataController) { m_game = Dependencies.GameState; }
public void Select(int playerIndex) //this is player index (not owner index) { if (!IsSelected(playerIndex)) { m_selection |= (1ul << playerIndex); // Dependencies.GameView.GetViewport(m_gameState.PlayerToLocalIndex(pla)) if (m_gameState == null) { m_gameState = Dependencies.GameState; } if (m_gameState.IsLocalPlayer(playerIndex)) { if (m_renderer != null) { if (m_selectionOutlines == null) { m_selectionOutlines = new List <cakeslice.Outline>(); } cakeslice.Outline outline = m_renderer.gameObject.AddComponent <cakeslice.Outline>(); m_selectionOutlines.Add(outline); int localPlayerIndex = m_gameState.PlayerToLocalIndex(playerIndex); outline.layerMask = GameConstants.PlayerLayerMasks[localPlayerIndex]; if (Owner == playerIndex) { outline.color = 0; } else { if (Owner != 0) { outline.color = 1; } else { outline.color = 2; } } } if (m_uiPrefab != null) { VoxelUI ui = Instantiate(m_uiPrefab, transform, false); int localPlayerIndex = m_gameState.PlayerToLocalIndex(playerIndex); foreach (Transform t in ui.GetComponentsInChildren <Transform>(true)) { t.gameObject.layer = GameConstants.PlayerLayers[localPlayerIndex]; } ui.LocalPlayerIndex = localPlayerIndex; if (m_ui == null) { m_ui = new List <VoxelUI>(); } m_ui.Add(ui); UpdateUIVisibility(); } } OnSelect(playerIndex); } }