private void LoadMap() { //if (Map.Preview != null) { // MapPreview = Map.GetPreviewTexture(GraphicsDevice); //} else { // MapPreview = null; //} Map.Initialize(); Tactical.SetMap(Map); INI.Rules_Combined = new INI(); INI.Rules_Combined.CombineWithFile(INI.Rules_INI); INI.Rules_Combined.CombineWithFile(Map.MapFile); TiberiumClass.LoadListFromINI(INI.Rules_Combined); OverlayTypeClass.LoadListFromINI(INI.Rules_Combined); IsoTileTypeClass.LoadListFromINI(Map.TheaterData, true); IsoTileTypeClass.PrepaintTiles(); TiberiumClass.All.ReadAllFromINI(INI.Rules_Combined); CCFactory <OverlayTypeClass, OverlayClass> .Get().ReadAllFromINI(INI.Rules_Combined); Map.SetupOverlays(); }
public override IEnumerator Use(Tactical tactic) { yield return(base.Use(tactic)); var positions = tactic.priorityPositions; var opponentFieldSlots = GetOpponentFieldSlots(); var opponentFieldSlot = opponentFieldSlots[positions[0]]; var opponentImage = opponentFieldSlot.GetComponent <Image>(); var ownFieldSlot = GetOwnFieldSlot(); var ownImage = ownFieldSlot.GetComponent <Image>(); opponentImage.color = markColor; ownImage.color = selectColor; yield return(new WaitForSeconds(.125f)); opponentImage.color = Color.white; ownImage.color = Color.white; opponentImage = null; ownImage = null; positions = null; opponentFieldSlots = null; opponentFieldSlot = null; }
public void AddTactic(Tactical tactic, AbilityItem abilityItem = null) { this.tactic = tactic; this.abilityItem = abilityItem ?? this.abilityItem; HandleTitle(); FitHeight(); }
public void AddItem(Tactical tactic) { // Instantiate an ability item var item = Instantiate <AvailableTacticItem>(itemPrefab, Vector2.zero, Quaternion.identity, container); item.tactic = tactic; item.HandleTitle(); }
public void SwitchTo(string station) { // disable all camera LobbyCamera.enabled = false; HelmCamera.enabled = false; TacticalCamera.enabled = false; SensorsCamera.enabled = false; SensorsCamera.enabled = false; // inactivate all interfaces Lobby.SetActive(false); Helm.SetActive(false); Tactical.SetActive(false); Sensors.SetActive(false); Sensors.SetActive(false); // activate the appropriate station switch (station) { case "lobby": LobbyCamera.enabled = true; Lobby.SetActive(true); Lobby.GetComponent <Lobby>().Activate(); break; case "helm": HelmCamera.enabled = true; Helm.SetActive(true); Helm.GetComponent <Helm>().Activate(); break; case "tactical": TacticalCamera.enabled = true; Tactical.SetActive(true); Tactical.GetComponent <Tactical>().Activate(); break; case "sensors": SensorsCamera.enabled = true; Sensors.SetActive(true); Sensors.GetComponent <Sensors>().Activate(); break; case "scanners": ScannersCamera.enabled = true; Scanners.SetActive(true); //Scanners.GetComponent<Scanners>().Activate(); break; } }
private void ReceiveMessage(string json) { // examine the generic message var generic = JsonUtility.FromJson <Message>(json); Debug.Log($"received: {json}"); // determine message and value if (generic.c == "telemetry") { var actual = JsonUtility.FromJson <Message <TelemetryPayload> >(json); if (actual.p.id == "00000000-0000-0000-0000-000000000000") { if (Helm.isActiveAndEnabled) { Helm.ReceiveTelemetry(actual.p); } } if (Sensors.isActiveAndEnabled) { Sensors.ReceiveTelemetry(actual.p); } } if (generic.c == "helm" && Helm.isActiveAndEnabled) { var actual = JsonUtility.FromJson <Message <FromHelmStation> >(json); Helm.ReceiveFromHelmStation(actual.p); } if (generic.c == "tactical" && Tactical.isActiveAndEnabled) { var actual = JsonUtility.FromJson <Message <FromTacticalStation> >(json); Tactical.ReceiveFromTacticalStation(actual.p); } if (generic.c == "zone") { Sensors.ReceiveZone(json); } // take note of the last received message LastReceivedAt = Time.realtimeSinceStartup; }
public void SetTactic(Tactical value) => tactic = value;
public void AddTactic(Tactical tactic) { tactics.Add(tactic); }
public void AddTactic(Tactical tactic) { tactic.owner = this; tactic.ability = ability; tactics.Add(tactic); }
public void AddTacticItem(Tactical tactic, TacticItem tacticItem) { ability.AddTactic(tactic); tacticItem.transform.SetParent(tacticContainer); tacticItem.AddTactic(tactic, this); }
void Start() { // references Network = GameObject.Find("Interface").GetComponent <Network>(); // make all camera objects active and all cameras but Lobby covered foreach (var camera in Resources.FindObjectsOfTypeAll <Camera>()) { switch (camera.name) { case "LobbyCamera": LobbyCamera = camera; LobbyCamera.gameObject.SetActive(true); LobbyCamera.enabled = true; break; case "HelmCamera": HelmCamera = camera; HelmCamera.gameObject.SetActive(true); HelmCamera.enabled = false; break; case "TacticalCamera": TacticalCamera = camera; TacticalCamera.gameObject.SetActive(true); TacticalCamera.enabled = false; break; case "SensorsCamera": SensorsCamera = camera; SensorsCamera.gameObject.SetActive(true); SensorsCamera.enabled = false; Sensors = camera.GetComponentInParent <Sensors>().gameObject; Sensors.SetActive(false); break; case "ScannersCamera": ScannersCamera = camera; ScannersCamera.gameObject.SetActive(true); ScannersCamera.enabled = false; break; } } // make all interfaces inactive except the lobby foreach (var canvas in Resources.FindObjectsOfTypeAll <Canvas>()) { switch (canvas.name) { case "Lobby": Lobby = canvas.gameObject; Lobby.SetActive(true); break; case "Helm": Helm = canvas.gameObject; Helm.SetActive(false); break; case "Tactical": Tactical = canvas.gameObject; Tactical.SetActive(false); break; case "Scanners": Scanners = canvas.gameObject; Scanners.SetActive(false); break; } } }
public override IEnumerator Use(Tactical tactic) { yield return(base.Use(tactic)); }
public void AddTactic(Tactical tactic) { tactic.ability = this; tactic.transform.SetParent(transform); tactics.Add(tactic); }
public virtual IEnumerator Use(Tactical tactic) { Debug.Log(character.name + " is using " + name + " with tactic " + tactic.description); yield return(null); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed) { this.Exit(); } var kState = Keyboard.GetState(); if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) { this.Exit(); } if (TimeSinceLogicUpdate.TotalMilliseconds < 40) { TimeSinceLogicUpdate += gameTime.ElapsedGameTime; var down = kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down); var up = kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up); var left = kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left); var right = kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right); if (down) { if (combinedState.HasFlag(combinedKeyState.vUp)) { combinedState &= ~combinedKeyState.vUp; } else { combinedState |= combinedKeyState.vDown; } } if (up) { if (combinedState.HasFlag(combinedKeyState.vDown)) { combinedState &= ~combinedKeyState.vDown; } else { combinedState |= combinedKeyState.vUp; } } if (left) { if (combinedState.HasFlag(combinedKeyState.vRight)) { combinedState &= ~combinedKeyState.vRight; } else { combinedState |= combinedKeyState.vLeft; } } if (right) { if (combinedState.HasFlag(combinedKeyState.vLeft)) { combinedState &= ~combinedKeyState.vLeft; } else { combinedState |= combinedKeyState.vRight; } } } else { if (Map != null) { var deltaX = 7; var deltaY = 7; TacticalClass.NudgeStatus moveStatus = TacticalClass.NudgeStatus.E_EDGE; if (combinedState.HasFlag(combinedKeyState.vUp)) { moveStatus = Tactical.NudgeY(-deltaY); } else if (combinedState.HasFlag(combinedKeyState.vDown)) { moveStatus = Tactical.NudgeY(+deltaY); } if (combinedState.HasFlag(combinedKeyState.vLeft)) { moveStatus = Tactical.NudgeX(-deltaX); } else if (combinedState.HasFlag(combinedKeyState.vRight)) { moveStatus = Tactical.NudgeX(+deltaX); } bool MapMoved = moveStatus != TacticalClass.NudgeStatus.E_EDGE; if (MapTexture == null || MapMoved) { MapTexture = Map.GetTexture(GraphicsDevice); } //if (MapTexture != null && kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.S)) { // var outdir = Directory.GetCurrentDirectory(); // var outfile = Path.Combine(outdir, "scr.png"); // using (FileStream s = File.OpenWrite(outfile)) { // MapTexture.SaveAsPng(s, MapTexture.Width, MapTexture.Height); // } //} } combinedState = 0; TimeSinceLogicUpdate = new TimeSpan(0); } //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Space)) { // offX = defOX; // offY = defOY; // rotation = defRotation; // scale = 1f; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up)) { // offY -= (int)scale; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down)) { // offY += (int)scale; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left)) { // offX -= (int)scale; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right)) { // offX += (int)scale; //} //var rot = MathHelper.PiOver4 / 4; //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Q)) { // rotation.X += rot; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A)) { // rotation.X -= rot; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.W)) { // rotation.Y += rot; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.S)) { // rotation.Y -= rot; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.E)) { // rotation.Z += rot; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D)) { // rotation.Z -= rot; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Multiply)) { // scale *= 1.01f; //} else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Divide)) { // scale /= 1.01f; //} //if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.L)) { // effect.LightingEnabled = !effect.LightingEnabled; //} //if (LoadedVoxels.Count > 0) { // var fcount = (int)(LoadedVoxels[0].MotLib.Header.FrameCount - 1); // if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z)) { // if (VoxelFrame < fcount) { // ++VoxelFrame; // } else { // VoxelFrame = 0; // } // VoxelChanged = true; // } else if (kState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X)) { // if (VoxelFrame > 0) { // --VoxelFrame; // } else { // VoxelFrame = fcount; // } // VoxelChanged = true; // } //} //// TODO: Add your update logic here var pos = Mouse.GetState(); MousePos.X = pos.X; MousePos.Y = pos.Y; if (MouseFrameChanged) { MouseTextures.GetTexture((uint)MouseFrame, ref MouseTexture); } //if (VoxelChanged) { // VoxelChanged = false; // if (MousePalette != null) { // var combinedVertices = new List<VXL.VertexPositionColorNormal>(); // var combinedIndices = new List<int>(); // foreach (var V in LoadedVoxels) { // var Vertices = new List<VXL.VertexPositionColorNormal>(); // var Indices = new List<int>(); // V.Voxel.GetVertices(MousePalette, VoxelFrame, Vertices, Indices); // var indexShift = combinedVertices.Count; // combinedVertices.AddRange(Vertices); // combinedIndices.AddRange(Indices.Select(ix => ix + indexShift)); // // break; // } // VoxelContent = combinedVertices.ToArray(); // VoxelIndices = combinedIndices.ToArray(); // //Console.WriteLine("Loaded {0} vertices and {1} indices", VoxelContent.Length, VoxelIndices.Length); // if (vertexBuffer != null) { // vertexBuffer.Dispose(); // } // // Initialize the vertex buffer, allocating memory for each vertex. // vertexBuffer = new VertexBuffer(graphics.GraphicsDevice, VXL.VertexPositionColorNormal.VertexDeclaration, VoxelContent.Length, BufferUsage.WriteOnly); // // Set the vertex buffer data to the array of vertices. // vertexBuffer.SetData<VXL.VertexPositionColorNormal>(VoxelContent); // indexBuffer = new IndexBuffer(graphics.GraphicsDevice, typeof(int), VoxelIndices.Length, BufferUsage.WriteOnly); // indexBuffer.SetData(VoxelIndices); // } //} base.Update(gameTime); }