Beispiel #1
0
 /// <summary>
 /// Refresh graphics of this tile.
 /// </summary>
 public void Refresh(TileData state)
 {
     if (!state.discovered)
     {
         unexplored.enabled = true;
     }
     else
     {
         SpriteOrientationData groundSprite = SpriteRegistry.GetSprite((state.land? "Land" : "Water")).GetSprite(state.landConnections[0], state.landConnections[1], state.landConnections[2], state.landConnections[3]);
         groundGfx.sprite             = groundSprite.sprite;
         groundGfx.transform.rotation = Quaternion.Euler(0f, 0f, groundSprite.rotation);
         if (state.feature == "empty")
         {
             featureGfx.enabled = false;
         }
         else
         {
             featureGfx.enabled = true;
             SpriteOrientationData featureSprite = SpriteRegistry.GetSprite(state.feature).GetSprite(state.featureConnections[0], state.featureConnections[1], state.featureConnections[2], state.featureConnections[3]);
             featureGfx.sprite             = featureSprite.sprite;
             featureGfx.transform.rotation = Quaternion.Euler(0f, 0f, featureSprite.rotation);
         }
         unitGfx.SetUnit(state.unit);
         structureGfx.SetStructure(state.structure);
         fogOfWar.enabled   = !state.visible;
         unexplored.enabled = false;
     }
 }
        public void Setup(UnitType unit, Color color, bool isSelected, UnityAction <bool> onToggle)
        {
            unitName.text = unit.name;

            background.color = color;
            unitIcon.color   = color;

            unitIcon.sprite = SpriteRegistry.GetSprite(unit.name).GetSprite(false, false, false, false).sprite;

            toggle.isOn = isSelected;
            toggle.onValueChanged.AddListener(onToggle);
        }
Beispiel #3
0
 public void SetStructure(StructureData structure)
 {
     if (structure == null)
     {
         background.enabled = false;
         icon.enabled       = false;
     }
     else
     {
         icon.sprite        = SpriteRegistry.GetSprite(structure.structure).GetSprite(false, false, false, false).sprite;
         icon.color         = ClientController.gameState.GetPlayer(structure.owner).color;
         background.enabled = true;
         icon.enabled       = true;
     }
 }
Beispiel #4
0
        void ShowGraphics(UnitData unit)
        {
            if (unit == null)
            {
                Hide();
                return;
            }

            unitSprite.sprite = SpriteRegistry.GetSprite(unit.unitType).GetSprite(false, false, false, false).sprite;
            playerColor       = ClientController.gameState.GetPlayer(unit.owner).color;
            unitSprite.color  = playerColor;
            Color backgroundColor = playerColor;

            if (unit.sleeping)
            {
                backgroundColor = Color.white;
            }
            unitBackground.color = backgroundColor;

            unitSprite.enabled     = true;
            unitBackground.enabled = true;
        }
Beispiel #5
0
 private void Awake()
 {
     instance = this;
 }