public void SetType(HexagonType type)
    {
        image.color = Color.white;

        switch (type)
        {
        case HexagonType.Empty:
            image.sprite = null;
            image.color  = Color.clear;
            break;

        case HexagonType.Emit:
            image.sprite = emitSprite;
            break;

        case HexagonType.Ricochet:
            image.sprite = ricochetSprite;
            break;

        case HexagonType.Split:
            image.sprite = splitSprite;
            break;

        case HexagonType.Stop:
            image.sprite = stopSprite;
            break;
        }
    }
    public void ReplaceHexagonType(HexagonType newValue)
    {
        var index     = GameComponentsLookup.HexagonType;
        var component = (Sources.Components.HexagonTypeComponent)CreateComponent(index, typeof(Sources.Components.HexagonTypeComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Пример #3
0
 public static Vector3 GetCorner(HexagonType hexagonType, int index)
 {
     if (hexagonType == HexagonType.PointyTopped)
     {
         return(corners[index]);
     }
     return(new Vector3(corners[index].z, corners[index].y, -corners[index].x));
 }
Пример #4
0
    public void ReplaceHexagonType(HexagonType newValue)
    {
        var index     = GameComponentsLookup.HexagonType;
        var component = CreateComponent <HexagonTypeComponent>(index);

        component.value = newValue;
        ReplaceComponent(index, component);
    }
        public Vector3 ToVector3(HexagonType hexagonType)
        {
            if (hexagonType == HexagonType.PointyTopped)
            {
                return(ToVector3Pointy());
            }
            var vec = ToVector3Pointy();

            return(new Vector3(vec.z, vec.y, vec.x));
        }
 internal void SetType(HexagonType value)
 {
     if (collection.Any())
     {
         var hexduet = collection.FirstOrDefault(x => x.type == value);
         if (hexduet != null)
         {
             image.sprite = hexduet.sprite;
             image.color  = hexduet.color;
         }
     }
 }
Пример #7
0
    private void CreateHexagon(int x, int y)
    {
        if (IsWithinBounds(x, y))
        {
            GameObject hexagon = Instantiate(_hexagonPrefab, Vector2.zero, Quaternion.identity, parent: _hexagonsParent);
            hexagon.name = "Hex " + (x * _height + (y + 1));

            HexagonType hexType             = GameManager.Instance.IsTimeForSpawnBomb ? HexagonType.Bomb : HexagonType.Normal;
            int         randomHexColorIndex = Random.Range(0, _defaultHexColors.Length);
            Color       hexColor            = _defaultHexColors[randomHexColorIndex];

            _allHexagons[x, y] = hexagon.GetComponent <Hexagon>();
            _allHexagons[x, y].Init(hexType, hexColor, randomHexColorIndex, x, y);

            DropHexagon(_allTiles[x, y]);

            if (hexType == HexagonType.Bomb)
            {
                GameManager.Instance.BombActivated(bombTransform: hexagon.transform);
            }
        }
    }
Пример #8
0
 private void SetType(HexagonType type)
 {
     Type = type;
 }
Пример #9
0
 public void Init(HexagonType type, Color color, int colorIndex, int xIndex, int yIndex)
 {
     SetType(type);
     SetColor(colorIndex, color);
     SetIndexes(xIndex, yIndex);
 }
Пример #10
0
 public HexagonContent(HexagonElement element)
 {
     type         = HexagonType.Element;
     this.element = element;
     frozen       = false;
 }
Пример #11
0
 public HexagonContent(HexagonType type = HexagonType.Empty, HexagonElement element = HexagonElement.None, bool frozen = false)
 {
     this.type    = type;
     this.element = element;
     this.frozen  = frozen;
 }
Пример #12
0
 public static Rect CreateHexagonRect(HexagonType hexagonType, in int range, in float hexSize)