Ejemplo n.º 1
0
        public void checkData()
        {
            if (state == uiState.SOCIETY)
            {
                //GraphicalSociety.checkData();
                //uiSociety.setTo(GraphicalSociety.focal);
                bViewSocietyText.text = "View World";
                viewSocietyButton.SetActive(true);
            }
            else if (state == uiState.WORLD)
            {
                GraphicalMap.checkData();
                bViewSocietyText.text = "View Society";
                viewSocietyButton.SetActive(GraphicalMap.selectedHex != null && GraphicalMap.selectedHex.location != null && GraphicalMap.selectedHex.location.soc is Society);
            }
            else
            {
                viewSocietyButton.SetActive(false);
            }

            if (state == uiState.BACKGROUND)
            {
                return;
            }
            if (state == uiState.MAIN_MENU)
            {
                return;
            }

            uiLeftPrimary.checkData();
            uiMidTop.checkData();
            uiScrollables.checkData();
        }
        public void checkData()
        {
            if (state == uiState.SOCIETY)
            {
                //GraphicalSociety.checkData();
                //uiSociety.setTo(GraphicalSociety.focal);
            }
            else if (state == uiState.WORLD)
            {
                GraphicalMap.checkData();
            }

            if (state == uiState.BACKGROUND)
            {
                return;
            }
            if (state == uiState.MAIN_MENU)
            {
                return;
            }

            uiLeftPrimary.checkData();
            uiMidTop.checkData();
            uiScrollables.checkData();
        }
Ejemplo n.º 3
0
        // Update is called once per frame
        void Update()
        {
            if (needed == false)
            {
                try
                {
                    if (hex.location != null)
                    {
                        foreach (Property p in hex.location.properties)
                        {
                            if (p.outer != null)
                            {
                                Destroy(p.outer.gameObject);
                            }
                        }
                    }
                    Destroy(this.gameObject);
                }
                catch (Exception e)
                {
                    World.log(e.ToString());
                }
                return;
            }
            transform.localPosition = GraphicalMap.getLoc(this);

            if (this.societyNameTag != null)
            {
                this.societyNameTag.gameObject.SetActive((GraphicalMap.scale != GraphicalMap.minScale) == Input.GetKey(KeyCode.LeftControl));
            }
        }
Ejemplo n.º 4
0
        public void setToSociety(Society soc)
        {
            state = uiState.SOCIETY;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(true);
            uiScrollables.gameObject.SetActive(true);
            uiMidTop.gameObject.SetActive(true);
            uiVoting.gameObject.SetActive(false);
            uIMidLower.gameObject.SetActive(false);
            hexSelector.SetActive(false);
            uiTopLight.gameObject.SetActive(true);

            uiScrollables.viewSocButtonText.text = "View World";

            GraphicalSociety.purge();
            GraphicalMap.purge();

            GraphicalSociety.setup(soc);

            uiLeftPrimary.maskTitle.text = "Neighbor Liking View";
            GraphicalSociety.refreshNeighbor(GraphicalSociety.focus);

            checkData();
        }
        public void Update()
        {
            if (scale > 1f)
            {
                return;
            }
            if (GraphicalMap.lastMapChange != lastCheck)
            {
                lastCheck = GraphicalMap.lastMapChange;
                gameObject.transform.position = ((GraphicalMap.getLoc(a) + GraphicalMap.getLoc(b)) / 2) + new Vector3(0, 0, -8);
            }

            frames += 1;
            float scaleStep = 0.02f;

            scale = frames * scaleStep;
            //gameObject.transform.localScale = new Vector3(scale,scale,1);

            float c = 1 - (scale * scale);

            if (c < 0)
            {
                c = 0;
            }
            sRend.color = new Color(1, 1, 1, c);

            if (scale > 1f)
            {
                gameObject.transform.localScale = new Vector3(0, 0, 1);
                Destroy(this.gameObject);
            }
        }
Ejemplo n.º 6
0
        public void Update()
        {
            if (unit.location.units.Contains(unit) == false)
            {
                unit.outer = null;
                Destroy(gameObject);
                return;
            }
            if (unit.location.hex.outer == null)
            {
                unit.outer = null;
                Destroy(this.gameObject);
                return;
            }

            gameObject.transform.localScale = new Vector3(0.5f * GraphicalMap.scale, 0.5f * GraphicalMap.scale, 1);

            Vector3 loc = GraphicalMap.getLoc(unit.location.hex);

            float radius = 0.4f * GraphicalMap.scale;

            if (unit.location.hex == GraphicalMap.selectedHex || unit == GraphicalMap.selectedSelectable)
            {
                radius = 0.7f * GraphicalMap.scale;
                loc    = loc + new Vector3(0, 0, -9f);
            }
            else if (GraphicalMap.selectedSelectable is Unit u && this.unit.hostileTo(u))
            {
                loc = loc + new Vector3(0, 0, -9f);
            }
Ejemplo n.º 7
0
        public void removeBlocker(GameObject block)
        {
            if (blocker == block)
            {
                if (blockerQueue.Count > 0)
                {
                    GameObject next = blockerQueue[0];
                    blockerQueue.RemoveAt(0);

                    next.SetActive(true);//Show new item from queue
                    blocker = next;
                }
                DestroyImmediate(block);
            }
            else if (blockerQueue.Contains(block))
            {
                blockerQueue.Remove(block);
                DestroyImmediate(block);
            }

            if (state == uiState.BACKGROUND)
            {
                setToWorld();
            }
            else if (state == uiState.WORLD)
            {
                GraphicalMap.checkData();
            }
            else
            {
                //GraphicalSociety.checkData();
            }
            checkData();
        }
Ejemplo n.º 8
0
        public void bFlashEnthrallables()
        {
            audioStore.playClick();

            map.param.flashEnthrallables = !map.param.flashEnthrallables;
            GraphicalMap.checkData();
        }
Ejemplo n.º 9
0
 public void onClick()
 {
     if (targetHex != null)
     {
         GraphicalMap.panTo(targetHex.x, targetHex.y);
     }
 }
        public void Update()
        {
            points[0]   = GraphicalMap.getLoc(link.a.hex);
            points[1]   = GraphicalMap.getLoc(link.b.hex);
            points[0].z = -0.06f;
            points[1].z = -0.06f;
            lineRenderer.SetPositions(points);


            lineRenderer.startColor = Color.white;
            lineRenderer.endColor   = Color.white;
            combatIcon.sprite       = null;
            if (link.a.soc != null && link.b.soc != null)
            {
                this.gameObject.transform.position = (GraphicalMap.getLoc(link.a.hex) + GraphicalMap.getLoc(link.b.hex)
                                                      + new Vector3(0, 0, -6)) / 2;
                if (link.a.hex.outer != null)
                {
                    this.gameObject.transform.localScale = link.a.hex.outer.transform.localScale;
                }

                if (link.a.soc.getRel(link.b.soc).state == DipRel.dipState.war)
                {
                    combatIcon.enabled      = true;
                    combatIcon.sprite       = link.a.hex.map.world.textureStore.icon_combat;
                    lineRenderer.startColor = Color.red;
                    lineRenderer.endColor   = Color.red;
                }
                else
                {
                    combatIcon.enabled = false;
                }
            }
        }
Ejemplo n.º 11
0
        public void agent_Standard()
        {
            overmind.map.overmind.availableEnthrallments -= 1;
            World.log("Spawning tester dark at turn " + overmind.map.turn);
            Location spawn = null;

            foreach (Unit u in overmind.map.units)
            {
                if (u is Unit_TesterDark)
                {
                    spawn = u.location.getNeighbours()[0];
                }
            }
            if (spawn == null)
            {
                spawn = overmind.map.locations[Eleven.random.Next(overmind.map.locations.Count)];
            }

            Unit agent = new Unit_TesterDark(spawn, overmind.map.soc_dark);

            agent.person       = new Person(overmind.map.soc_dark);
            agent.person.state = Person.personState.enthralledAgent;
            agent.person.unit  = agent;
            overmind.map.units.Add(agent);

            Evidence ev = new Evidence(overmind.map.turn);

            ev.pointsTo = agent;
            ev.weight   = 0.66;
            agent.location.evidence.Add(ev);

            agent.task = null;

            GraphicalMap.panTo(spawn.hex.x, spawn.hex.y);
        }
        public void scaling()
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                if (EventSystem.current.currentSelectedGameObject != null)
                {
                    return;
                }
            }

            if (world.ui.state == UIMaster.uiState.WORLD)
            {
                if (Input.GetKeyDown("z") || Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale * 1.1f;
                    if (GraphicalMap.scale > GraphicalMap.maxScale)
                    {
                        GraphicalMap.scale = GraphicalMap.maxScale;
                    }
                    GraphicalMap.checkData();
                }
                else if (Input.GetKeyDown("x") || Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale / 1.1f;
                    if (GraphicalMap.scale < GraphicalMap.minScale)
                    {
                        GraphicalMap.scale = GraphicalMap.minScale;
                    }
                    GraphicalMap.checkData();
                }
            }
        }
Ejemplo n.º 13
0
        public void bButton()
        {
            List <Unit> freeAgents  = new List <Unit>();
            List <Unit> busyAgents  = new List <Unit>();
            List <Unit> movedAgents = new List <Unit>();

            foreach (Unit u in world.map.units)
            {
                if (u.isEnthralled() && (!u.automated))
                {
                    if (u.movesTaken == 0)
                    {
                        if (u.task == null)
                        {
                            freeAgents.Add(u);
                        }
                        else if (u.task is Task_Disrupted == false)
                        {
                            busyAgents.Add(u);
                        }
                    }
                    else
                    {
                        movedAgents.Add(u);
                    }
                }
            }
            List <Unit> allAgents = new List <Unit>();

            allAgents.AddRange(freeAgents);
            allAgents.AddRange(busyAgents);
            allAgents.AddRange(movedAgents);

            if (allAgents.Count == 0)
            {
                return;
            }

            int index = 0;

            if (GraphicalMap.selectedSelectable is Unit)
            {
                if (allAgents.Contains((Unit)GraphicalMap.selectedSelectable))
                {
                    index = allAgents.IndexOf((Unit)GraphicalMap.selectedSelectable);
                    if (index < allAgents.Count - 1)
                    {
                        index += 1;
                    }
                    else
                    {
                        index = 0;
                    }
                }
            }
            GraphicalMap.selectedSelectable = allAgents[index];
            GraphicalMap.panTo(allAgents[index].location.hex.x, allAgents[index].location.hex.y);
            world.ui.checkData();
        }
Ejemplo n.º 14
0
        public void save(string filename)
        {
            World world = this;

            world.ui.setToMainMenu();
            GraphicalMap.purge();
            GraphicalSociety.purge();
            world.map.world = null;
Ejemplo n.º 15
0
 public void dismissAgentB()
 {
     GraphicalMap.panTo(agentB.location.hex.x, agentB.location.hex.y);
     if (agentB.location.units.Contains(agentB))
     {
         GraphicalMap.selectedSelectable = agentB;
     }
     ui.removeBlocker(this.gameObject);
 }
Ejemplo n.º 16
0
        public void save(string filename)
        {
            try
            {
                World world = this;
                // world.ui.setToMainMenu();
                GraphicalMap.purge();
                GraphicalSociety.purge();
                world.map.world = null;


                //foreach (SocialGroup sg in map.socialGroups)
                //{
                //    if (sg is Society)
                //    {
                //        Society soc = (Society)sg;
                //        soc.voteSession = null;
                //    }
                //}

                fsSerializer _serializer = new fsSerializer();
                fsData       data;
                _serializer.TrySerialize(typeof(Map), map, out data).AssertSuccessWithoutWarnings();

                // emit the data via JSON
                string saveString = fsJsonPrinter.CompressedJson(data);
                World.Log("Save exit point");

                if (File.Exists(filename))
                {
                    World.Log("Overwriting old save: " + filename);
                    File.Delete(filename);
                }
                File.WriteAllLines(filename, new string[] { saveString });

                world.map.world = world;
                staticMap       = map;

                world.prefabStore.popMsg("Game saved as: " + filename);

                //// step 1: parse the JSON data
                //fsData data = fsJsonParser.Parse(serializedState);

                //// step 2: deserialize the data
                //object deserialized = null;
                //_serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
            }catch (Exception e)
            {
                World.log(e.Message);
                World.log(e.StackTrace);
                prefabStore.popMsg("Failure to save");
                prefabStore.popMsg("Exception: " + e.StackTrace);
            }
        }
        /*
         * public void bViewSociety()
         * {
         *  if (GraphicalMap.selectedHex == null) { return; }
         *  if (GraphicalMap.selectedHex.owner == null) { return; }
         *  if (GraphicalMap.selectedHex.owner is Society == false) { return; }
         *  if (GraphicalMap.selectedHex.settlement != null)
         *  {
         *      if (GraphicalMap.selectedHex.settlement is Set_City)
         *      {
         *          Set_City city = (Set_City)GraphicalMap.selectedHex.settlement;
         *          if (city.lordSlot != null)
         *          {
         *              setToSociety(city.lordSlot.society, city.lordSlot);
         *              return;
         *          }
         *      }
         *  }
         *  setToSociety((Society)GraphicalMap.selectedHex.owner);
         * }
         */

        /*
         * public void setToSociety(Society soc)
         * {
         *  state = uiState.SOCIETY;
         *  uiWorldRight.gameObject.SetActive(false);
         *  uiHex.gameObject.SetActive(false);
         *  uiMainMenu.gameObject.SetActive(false);
         *  uiSociety.gameObject.SetActive(true);
         *  uiCommon.gameObject.SetActive(true);
         *  uiCity.gameObject.SetActive(false);
         *  GraphicalMap.purge();
         *
         *  GraphicalSociety.centreOn(soc.command.top);
         *  uiSociety.setTo(soc.command.top.person);
         * }
         * public void setToSociety(Society soc, Slot slot)
         * {
         *  state = uiState.SOCIETY;
         *  uiWorldRight.gameObject.SetActive(false);
         *  uiHex.gameObject.SetActive(false);
         *  uiMainMenu.gameObject.SetActive(false);
         *  uiSociety.gameObject.SetActive(true);
         *  uiCommon.gameObject.SetActive(true);
         *  uiCity.gameObject.SetActive(false);
         *  GraphicalMap.purge();
         *
         *  GraphicalSociety.centreOn(slot);
         *  uiSociety.setTo(slot.person);
         * }
         */

        public void setToBackground()
        {
            state = uiState.BACKGROUND;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            GraphicalMap.purge();
            GraphicalSociety.purge();
        }
Ejemplo n.º 18
0
        // Update is called once per frame
        void Update()
        {
            if (needed == false)
            {
                try
                {
                    if (hex.location != null)
                    {
                        foreach (Property p in hex.location.properties)
                        {
                            if (p.outer != null)
                            {
                                Destroy(p.outer.gameObject);
                            }
                        }
                        foreach (Unit p in hex.location.units)
                        {
                            if (p.outer != null)
                            {
                                Destroy(p.outer.gameObject);
                            }
                        }
                    }
                    Destroy(this.gameObject);
                }
                catch (Exception e)
                {
                    World.log(e.ToString());
                }
                return;
            }
            transform.localPosition = GraphicalMap.getLoc(this);

            if (this.societyNameTag != null)
            {
                this.societyNameTag.gameObject.SetActive((GraphicalMap.scale != GraphicalMap.minScale) == Input.GetKey(KeyCode.LeftControl));
            }

            if (map.param.flashEnthrallables && map.overmind.enthralled == null && map.overmind.hasEnthrallAbilities)
            {
                if (hex.location != null && hex.location.person() != null)
                {
                    if (hex.location.person().enthrallable())
                    {
                        float c = Mathf.Sin(Time.fixedTime * 4);
                        terrainLayer.color = new Color(1, c, 1);
                    }
                }
            }
        }
Ejemplo n.º 19
0
 public void load(string filename)
 {
     try
     {
         if (map != null)
         {
             GraphicalMap.purge();
             GraphicalSociety.purge();
             map.world = null;
             map       = null;
         }
         filename = saveFolder + filename;
         string fullFile = File.ReadAllText(filename);
         //string serializedState = fullFile.Substring(fullFile.IndexOf("\n"), fullFile.Length);
         int          startIndex      = fullFile.IndexOf(saveHeader) + saveHeader.Length;
         int          endIndex        = fullFile.Length - startIndex;
         string       serializedState = fullFile.Substring(startIndex, endIndex);
         fsSerializer _serializer     = new fsSerializer();
         fsData       data            = fsJsonParser.Parse(serializedState);
         World.Log("Data parsed");
         object deserialized = null;
         _serializer.TryDeserialize(data, typeof(Map), ref deserialized).AssertSuccessWithoutWarnings();
         World.saveLog.takeLine("Finished deserial");
         map       = (Map)deserialized;
         map.world = this;
         staticMap = map;
         World.self.displayMessages = true;
         GraphicalMap.map           = map;
         //ui.setToMainMenu();
         //GraphicalMap.checkLoaded();
         //GraphicalMap.checkData();
         //graphicalMap.loadArea(0, 0);
         map.decompressFromSave();
         prefabStore.popMsg("Loaded file: " + filename, true);
         World.Log("reached end of loading code");
         // prefabStore.popMsg("Load may well have succeeded.");
     }
     catch (FileLoadException e)
     {
         Debug.Log(e);
         World.log(e.StackTrace);
         prefabStore.popMsg("Exception: " + e.StackTrace, true);
     }
     catch (Exception e2)
     {
         Debug.Log(e2);
         World.log(e2.StackTrace);
         prefabStore.popMsg("Exception: " + e2.StackTrace, true);
     }
 }
        public void setToSociety(Society soc)
        {
            state = uiState.SOCIETY;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(true);
            uiScrollables.gameObject.SetActive(true);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            uiScrollables.viewSocButtonText.text = "View World";

            GraphicalMap.purge();
            GraphicalSociety.setup(soc);
        }
Ejemplo n.º 21
0
 public void clicked(Map map)
 {
     //selector.selected(person,agent);
     if (person.getLocation() != null)
     {
         try
         {
             GraphicalMap.panTo(person.getLocation().hex.x, person.getLocation().hex.y);
         }
         catch
         {
             //Ignore
         }
     }
 }
        public void setToMainMenu()
        {
            state = uiState.MAIN_MENU;

            uiMainMenu.gameObject.SetActive(true);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            if (World.staticMap != null)
            {
                GraphicalSociety.purge();
                GraphicalMap.purge();
            }
        }
Ejemplo n.º 23
0
        public void load(string filename)
        {
            try
            {
                if (map != null)
                {
                    GraphicalMap.purge();
                    GraphicalSociety.purge();
                    map.world = null;
                    map       = null;
                }

                string       serializedState = File.ReadAllText(filename);
                fsSerializer _serializer     = new fsSerializer();
                fsData       data            = fsJsonParser.Parse(serializedState);
                World.Log("Data parsed");
                object deserialized = null;
                _serializer.TryDeserialize(data, typeof(Map), ref deserialized).AssertSuccessWithoutWarnings();
                World.saveLog.takeLine("Finished deserial");
                map              = (Map)deserialized;
                map.world        = this;
                staticMap        = map;
                GraphicalMap.map = map;
                //ui.setToMainMenu();
                //GraphicalMap.checkLoaded();
                //GraphicalMap.checkData();
                //graphicalMap.loadArea(0, 0);
                prefabStore.popMsg("Loaded file: " + filename);
                World.Log("reached end of loading code");
                // prefabStore.popMsg("Load may well have succeeded.");
            }
            catch (FileLoadException e)
            {
                Debug.Log(e);
                World.log(e.StackTrace);
                prefabStore.popMsg("Exception: " + e.StackTrace);
            }
            catch (Exception e2)
            {
                Debug.Log(e2);
                World.log(e2.StackTrace);
                prefabStore.popMsg("Exception: " + e2.StackTrace);
            }
        }
Ejemplo n.º 24
0
        public void rightClickOnHex()
        {
            Hex clickedHex = GraphicalMap.getHexUnderMouse(Input.mousePosition).hex;

            if (clickedHex.location != null)
            {
                if (GraphicalMap.selectedSelectable != null &&
                    GraphicalMap.selectedSelectable is Unit &&
                    ((Unit)GraphicalMap.selectedSelectable).isEnthralled() &&
                    (!((Unit)GraphicalMap.selectedSelectable).automated))
                {
                    Unit u = (Unit)GraphicalMap.selectedSelectable;
                    if (u.location == clickedHex.location)
                    {
                        if (u.task is Task_GoToLocation)
                        {
                            u.task = null;//Cancel the move-to command
                        }
                    }
                    else if (u.location.getNeighbours().Contains(clickedHex.location))
                    {
                        if (u.movesTaken == 0)
                        {
                            u.location.map.adjacentMoveTo(u, clickedHex.location);
                            u.movesTaken += 1;
                            u.location.map.world.audioStore.playClickSelect();
                            u.task = null;

                            EventManager.onEnthralledUnitMove(u.location.map, u);
                        }
                    }
                    else
                    {
                        u.task = new Task_GoToLocation(clickedHex.location);
                        if (u.movesTaken == 0)
                        {
                            u.task.turnTick(u);
                            u.location.map.world.audioStore.playClickSelect();
                            EventManager.onEnthralledUnitMove(u.location.map, u);
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public void bWatch()
        {
            if (GraphicalMap.selectedSelectable == null || GraphicalMap.selectedSelectable is Unit == false)
            {
                return;
            }
            Unit u = (Unit)GraphicalMap.selectedSelectable;

            if (u.person != null)
            {
                u.person.watched = true;
                world.prefabStore.popMsgAgent(u, u, u.getName() + " is now flagged as `watched'. You will receive updates on key events regarding them (such as promotions and death).");
            }
            else
            {
                world.prefabStore.popMsg(u.getName() + " cannot be set to be watched as it is a generic unit, it is not an agent.");
            }
            GraphicalMap.checkData();
        }
Ejemplo n.º 26
0
        public void bSetAsHostile()
        {
            if (GraphicalMap.selectedSelectable == null || GraphicalMap.selectedSelectable is Unit == false)
            {
                return;
            }
            Unit u = (Unit)GraphicalMap.selectedSelectable;

            u.flaggedAsEnthralledHostile = !u.flaggedAsEnthralledHostile;
            if (u.flaggedAsEnthralledHostile)
            {
                world.prefabStore.popMsgAgent(u, u, "All your enthralled units will now automatically attack " + u.getName() + " if they enter into the same location.");
            }
            else
            {
                world.prefabStore.popMsgAgent(u, u, "Your enthralled agents will only attack " + u.getName() + " if " + u.getName() + " is hostile to them.");
            }
            GraphicalMap.checkData();
        }
Ejemplo n.º 27
0
        public void setToVoting()
        {
            state = uiState.VOTING;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            uiVoting.gameObject.SetActive(true);
            uIMidLower.gameObject.SetActive(false);
            hexSelector.SetActive(false);
            uiTopLight.gameObject.SetActive(false);


            if (World.staticMap != null)
            {
                GraphicalSociety.purge();
                GraphicalMap.purge();
            }
        }
Ejemplo n.º 28
0
        public void bViewSociety()
        {
            if (state == uiState.SOCIETY)
            {
                if (GraphicalSociety.focus != null)
                {
                    Location loc = GraphicalSociety.focus.getLocation();
                    if (loc != null)
                    {
                        Hex hex = loc.hex;
                        GraphicalMap.panTo(hex.x, hex.y);
                        GraphicalMap.selectedHex = hex;
                    }
                }

                world.audioStore.playClick();
                setToWorld();
            }
            else if (state == uiState.WORLD)
            {
                if (GraphicalMap.selectedHex == null)
                {
                    return;
                }
                if (GraphicalMap.selectedHex.owner == null)
                {
                    return;
                }
                if (GraphicalMap.selectedHex.owner is Society == false)
                {
                    return;
                }

                world.audioStore.playClick();

                GraphicalSociety.focus = GraphicalMap.selectedHex.location.person();
                setToSociety((Society)GraphicalMap.selectedHex.owner);
            }
        }
Ejemplo n.º 29
0
        public void rightClickOnHex()
        {
            Hex clickedHex = GraphicalMap.getHexUnderMouse(Input.mousePosition).hex;

            if (clickedHex.location != null)
            {
                if (GraphicalMap.selectedSelectable != null && GraphicalMap.selectedSelectable is Unit && ((Unit)GraphicalMap.selectedSelectable).isEnthralled())
                {
                    Unit u = (Unit)GraphicalMap.selectedSelectable;
                    if (u.location.getNeighbours().Contains(clickedHex.location))
                    {
                        if (u.movesTaken == 0)
                        {
                            u.location.map.adjacentMoveTo(u, clickedHex.location);
                            u.movesTaken += 1;
                            u.location.map.world.audioStore.playClickSelect();
                            u.task = null;
                        }
                    }
                }
            }
        }
Ejemplo n.º 30
0
        public void Update()
        {
            if (GraphicalMap.world.ui.blocker != null)
            {
                sRend.color = Color.clear; return;
            }                                                                                //Hold while you can't see the particle

            if (scale > 1f)
            {
                Destroy(this.gameObject);
                return;
            }
            if (GraphicalMap.lastMapChange != lastCheck)
            {
                lastCheck = GraphicalMap.lastMapChange;
                gameObject.transform.position = ((GraphicalMap.getLoc(a) + GraphicalMap.getLoc(b)) / 2) + new Vector3(0, 0, -8);
            }

            frames += 1;
            float scaleStep = 0.02f;

            scale = frames * scaleStep;
            //gameObject.transform.localScale = new Vector3(scale,scale,1);

            float c = 1 - (scale * scale);

            if (c < 0)
            {
                c = 0;
            }
            sRend.color = new Color(1, 1, 1, c);
            gameObject.transform.localScale = new Vector3(0.5f + scale, 0.5f + scale, 1);

            if (scale > 1f)
            {
                gameObject.transform.localScale = new Vector3(0, 0, 1);
                Destroy(this.gameObject);
            }
        }