Example #1
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));
            }
        }
        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;
                }
            }
        }
        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);
            }
        }
        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);
            }
Example #5
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);
                    }
                }
            }
        }
Example #6
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);
            }
        }
Example #7
0
        public void Update()
        {
            if (location.properties.Contains(property) == false)
            {
                property.outer = null;
                Destroy(gameObject);
                return;
            }
            if (location.hex.outer == null)
            {
                property.outer = null;
                Destroy(this.gameObject);
                return;
            }

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

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

            float radius = 0.55f * GraphicalMap.scale;

            if (location.hex == GraphicalMap.selectedHex || property == GraphicalMap.selectedSelectable)
            {
                radius = 1.1f * GraphicalMap.scale;
                loc    = loc + new Vector3(0, 0, -5f);
            }
            else
            {
                loc = loc + new Vector3(0, 0, -0.105f);
            }


            double ang = location.properties.IndexOf(property) + location.units.Count;

            ang   /= location.units.Count + location.properties.Count;
            ang   *= 6.28;
            loc.x += (float)(radius * Math.Sin(ang));
            loc.y += (float)(radius * Math.Cos(ang));



            Vector3 delta = loc - transform.position;

            if (GraphicalMap.lastMapChange == lastMapChange)
            {
                if (delta.magnitude > 0.175f)
                {
                    delta.Normalize();
                    delta *= 0.175f;
                }
            }
            else
            {
                lastMapChange = GraphicalMap.lastMapChange;
            }
            delta.z = loc.z - transform.position.z;
            transform.Translate(delta);

            //hostilityBorder.color = Color.clear;

            if (GraphicalMap.selectedSelectable != null)
            {
                if (GraphicalMap.selectedSelectable == property)
                {
                    wasSelectedUnit = true;
                    //if (((int)(Time.time*2))%2 == 0)
                    //{
                    float size = ((float)Math.Abs(Math.Sin(2 * Time.time)) * 0.5f + 0.5f) * GraphicalMap.scale;
                    gameObject.transform.localScale = new Vector3(size, size, 1);
                    //}
                }
            }
        }
        // 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);
                    }
                }
            }

            if (hex.location != null && hex.map.overmind != null && hex.map.overmind.lightbringerLocations.Contains(hex.location))
            {
                float alpha = (float)Math.Abs(Math.Sin(Time.time * 2));
                busyLayer.color = new Color(1, 1, 1, alpha);
            }
            else
            {
                busyLayer.color = Color.clear;
            }
            if (hex.location != null && hex.location.settlement != null)
            {
                float f = (float)Math.Sqrt(hex.location.settlement.infiltration);
                infiltrationLayer.color = new Color(1, 1, 1, f);
            }
            else
            {
                infiltrationLayer.color = Color.clear;
            }
        }
        public void Update()
        {
            if (world.map != null)
            {
                if (GraphicalMap.selectedHex == null || GraphicalMap.selectedHex.outer == null)
                {
                    hexSelector.SetActive(false);
                }
                else
                {
                    hexSelector.SetActive(true);
                    hexSelector.transform.localScale    = new Vector3(GraphicalMap.scale, GraphicalMap.scale, 1);
                    hexSelector.transform.localPosition = GraphicalMap.getLoc(GraphicalMap.selectedHex) + new Vector3(0, 0, -5);
                }

                if (state == uiState.WORLD)
                {
                    GraphicalMap.tick();
                    //if (GraphicalMap.selectedHex == null)
                    //{
                    //    //uiCity.gameObject.SetActive(false);
                    //    uiScrollables.gameObject.SetActive(true);
                    //}
                    //else
                    //{
                    //   uiScrollables.gameObject.SetActive(true);
                    //}
                }
                else if (state == uiState.SOCIETY)
                {
                    //GraphicalSociety.tick();
                }
            }
            else
            {
                hexSelector.SetActive(false);
            }

            if (state == uiState.WORLD)
            {
                uiLeftPrimary.titleTextDarkener.enabled = GraphicalMap.map.masker.mask != MapMaskManager.maskType.NONE;
                uiLeftPrimary.bodyTextDarkener.enabled  = GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_ME ||
                                                          GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_THEM ||
                                                          GraphicalMap.map.masker.mask == MapMaskManager.maskType.VOTE_EFFECT;
                if (world.map.masker.mask != MapMaskManager.maskType.NONE)
                {
                    uiLeftPrimary.maskTitle.text = GraphicalMap.map.masker.getTitleText();
                    uiLeftPrimary.maskBody.text  = GraphicalMap.map.masker.getBodyText();
                }
                else
                {
                    uiLeftPrimary.maskTitle.text = "";
                    uiLeftPrimary.maskBody.text  = "";
                }

                uiTopLight.gameObject.SetActive(true);
                //uiLeftPrimary.unlandedViewButton.gameObject.SetActive(false);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(false);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(false);
                //uiLeftPrimary.dynamicViewButton.gameObject.SetActive(false);
                endTurnButton.SetActive(true);
            }
            else if (state == uiState.SOCIETY)
            {
                uiLeftPrimary.maskBody.text             = "";
                uiLeftPrimary.titleTextDarkener.enabled = true;
                uiLeftPrimary.bodyTextDarkener.enabled  = false;

                uiTopLight.gameObject.SetActive(false);
                //uiLeftPrimary.unlandedViewButton.gameObject.SetActive(true);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(true);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(GraphicalSociety.activeSociety != null && GraphicalSociety.activeSociety.getSovereign() != null);
                //uiLeftPrimary.dynamicViewButton.gameObject.SetActive(true);
                endTurnButton.SetActive(false);

                GraphicalSociety.update();
            }
            else
            {
                uiLeftPrimary.maskTitle.text            = "";
                uiLeftPrimary.maskBody.text             = "";
                uiLeftPrimary.titleTextDarkener.enabled = false;
                uiLeftPrimary.bodyTextDarkener.enabled  = false;

                uiLeftPrimary.unlandedViewButton.gameObject.SetActive(false);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(false);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(false);
            }

            if (state == uiState.MAIN_MENU)
            {
                uiMainMenu.continueButton.gameObject.SetActive(World.staticMap != null);
            }

            checkBlockerQueue();
        }
Example #10
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.75f * GraphicalMap.scale, 0.75f * GraphicalMap.scale, 1);

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

            float radius = 0.55f * GraphicalMap.scale;

            if (unit.location.hex == GraphicalMap.selectedHex || unit == GraphicalMap.selectedSelectable)
            {
                radius = 1.1f * GraphicalMap.scale;
                loc    = loc + new Vector3(0, 0, -5f);
            }
            else
            {
                loc = loc + new Vector3(0, 0, -0.105f);
            }


            double ang = unit.location.units.IndexOf(unit);

            ang   /= unit.location.units.Count + unit.location.properties.Count;
            ang   *= 6.28;
            loc.x += (float)(radius * Math.Sin(ang));
            loc.y += (float)(radius * Math.Cos(ang));



            Vector3 delta = loc - transform.position;

            if (GraphicalMap.lastMapChange == lastMapChange)
            {
                if (delta.magnitude > 0.175f)
                {
                    delta.Normalize();
                    delta *= 0.175f;
                }
            }
            else
            {
                lastMapChange = GraphicalMap.lastMapChange;
            }
            delta.z = loc.z - transform.position.z;
            transform.Translate(delta);

            //hostilityBorder.color = Color.clear;

            if (GraphicalMap.selectedSelectable == unit)
            {
                wasSelectedUnit = true;
                //if (((int)(Time.time*2))%2 == 0)
                //{
                float size = ((float)Math.Abs(Math.Sin(2 * Time.time)) * 0.5f + 0.5f) * GraphicalMap.scale;
                gameObject.transform.localScale = new Vector3(size, size, 1);
                //}
            }


            if (unit.person != null && unit.person.state == Person.personState.enthralledAgent)
            {
                borderLayer1.color = Color.black;
                borderLayer2.color = Color.black;
            }
            else if (unit.society == null || unit.dontDisplayBorder)
            {
                borderLayer1.color = Color.clear;
                borderLayer2.color = Color.clear;
            }
            else
            {
                borderLayer1.color = unit.society.color;
                borderLayer2.color = unit.society.color2;
            }
        }
        public void Update()
        {
            if (world.map != null)
            {
                if (GraphicalMap.selectedHex == null || GraphicalMap.selectedHex.outer == null)
                {
                    hexSelector.SetActive(false);
                }
                else
                {
                    hexSelector.SetActive(true);
                    hexSelector.transform.localScale    = new Vector3(GraphicalMap.scale, GraphicalMap.scale, 1);
                    hexSelector.transform.localPosition = GraphicalMap.getLoc(GraphicalMap.selectedHex) + new Vector3(0, 0, -5);
                }

                if (state == uiState.WORLD)
                {
                    GraphicalMap.tick();
                    if (GraphicalMap.selectedHex == null)
                    {
                        //uiCity.gameObject.SetActive(false);
                        uiScrollables.gameObject.SetActive(true);
                    }
                    else
                    {
                        uiScrollables.gameObject.SetActive(true);
                    }
                }
                else if (state == uiState.SOCIETY)
                {
                    //GraphicalSociety.tick();
                }
            }
            else
            {
                hexSelector.SetActive(false);
            }

            if (state == uiState.WORLD)
            {
                uiLeftPrimary.titleTextDarkener.enabled = GraphicalMap.map.masker.mask != MapMaskManager.maskType.NONE;
                uiLeftPrimary.bodyTextDarkener.enabled  = GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_ME || GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_THEM;
                if (world.map.masker.mask != MapMaskManager.maskType.NONE)
                {
                    uiLeftPrimary.maskTitle.text = GraphicalMap.map.masker.getTitleText();
                    uiLeftPrimary.maskBody.text  = GraphicalMap.map.masker.getBodyText();
                }
                else
                {
                    uiLeftPrimary.maskTitle.text = "";
                    uiLeftPrimary.maskBody.text  = "";
                }
            }
            else
            {
                uiLeftPrimary.maskTitle.text            = "";
                uiLeftPrimary.maskBody.text             = "";
                uiLeftPrimary.titleTextDarkener.enabled = false;
                uiLeftPrimary.bodyTextDarkener.enabled  = false;
            }
            if (state == uiState.MAIN_MENU)
            {
                uiMainMenu.continueButton.gameObject.SetActive(World.staticMap != null);
                uiMainMenu.generateText.gameObject.SetActive(World.staticMap == null);
            }

            checkBlockerQueue();
        }