Пример #1
0
    private static void initProvince(ProvinceSettings provSettings)
    {
        map.ToggleProvinceSurface(map.GetProvinceIndex("Spain", provSettings.province), true, new Color(provSettings.initcolor.r / 255f, provSettings.initcolor.g / 255f, provSettings.initcolor.b / 255f), null, true);
        Vector2    barLocation  = map.GetCity(provSettings.city, "Spain").unity2DLocation;
        GameObject provinceBars = (GameObject)Instantiate(Resources.Load("Bar3DSimple"));

        map.AddMarker3DObject(provinceBars, barLocation, 0.5f);
        provinceBars.transform.eulerAngles = new Vector3(0, 0, 0);
        provinceBars.transform.localScale  = new Vector3(0.0005f, 0.0005f, 0.001f);
        provinceBars.transform.position    = new Vector3(provinceBars.transform.position.x, provinceBars.transform.position.y - 0.1f, -3);
    }
Пример #2
0
    public IEnumerator DrawPlayerBases()
    {
        int BaseId = 0;

        if (GameManager == null)
        {
            GameManager = FindObjectOfType <GameManager>();
        }
        if (GameManager.GameMilitaryManager == null)
        {
            yield return(new WaitForEndOfFrame());
        }
        else
        {
            foreach (var militaryBase in GameManager.GameMilitaryManager.PlayerMilitaryBases)
            {
                // Instantiate the sprite, face it to up and position it into the map
                // GameObject star = Instantiate(Resources.Load<Texture2D>(militaryBase.BaseIcon.name));
                GameObject marker = Instantiate(militaryBase.BaseMarker, GameManager.GameMilitaryManager.GamePlayerMilitaryBaseContainer.transform);

                GameObject mapIcon = new GameObject(string.Format(militaryBase.BaseIcon.name + "_base"));
                mapIcon.AddComponent <SpriteRenderer>().sprite = Sprite.Create(militaryBase.BaseIcon, new Rect(0.0f, 0.0f, militaryBase.BaseIcon.width, militaryBase.BaseIcon.height), new Vector2(0.5f, 0.5f), 100.0f);

                var gameBase = marker.AddComponent <GameMilitaryBase>();

                gameBase.BaseData = militaryBase;

                gameBase.GameBaseMaxSize           = 10;
                gameBase.GameBaseStrength          = militaryBase.BaseStrength;
                gameBase.GameBaseSupplyLevel       = 5000;
                gameBase.GameMaxBaseDecksAP        = 50;
                gameBase.BaseUniqueId              = BaseId;
                gameBase.MilitaryCountryBattleFlag = militaryBase.MilitaryCountryBattleFlag;

                if (militaryBase.BaseLocation != null)
                {
                    wmslObj.AddMarker2DSprite(mapIcon, militaryBase.BaseLocation, 0.002f);
                }

                marker.transform.localRotation = Quaternion.Euler(90, 0, 0);
                marker.transform.localScale    = WorldMapStrategyKit.Misc.Vector3one * 0.01f;
                marker.WMSK_MoveTo(militaryBase.BaseLocation.x, militaryBase.BaseLocation.y);
                wmslObj.AddMarker3DObject(marker, militaryBase.BaseLocation, 0.05f);
                marker.transform.SetParent(GameManager.GameMilitaryManager.GamePlayerMilitaryBaseContainer.transform);
                BaseId++;
            }
        }

        yield return(new WaitForEndOfFrame());
    }