Example #1
0
    private bool ReplaceDigit(int index, HexTypeEnum typeToDisplay)
    {
        Hex newHex = MapSpawner.Instance.SpawnHexAtLocation(MapSpawner.Instance.grid.WorldToCell(digitHexes[index].transform.position), typeToDisplay, true, MapSpawner.MAP_LAYER_DIGIT);

        //TODO: Move Component to new hex
        DigitComponent component = this;

        digitHexes[index].DigHex(false);
        digitHexes[index] = newHex;
        return(true);
    }
Example #2
0
    public override void AddAttributeToHex(Hex hexInstance)
    {
        Debug.Log("DigitElementAttribute::AddAttributeToHex");

        hexInstance.hexAttribute = this;

        // Add component?
        DigitComponent component = hexInstance.gameObject.AddComponent <DigitComponent>();

        component.leadingZeroCount = this.leadingZeroCount;
        component.numberToDisplay  = this.numberToDisplay;


        // NOTE: We may want some kind of delegate/ listener system for the number to automatically update its display upon vakue change
        // https://answers.unity.com/questions/1206632/trigger-event-on-variable-change.html
        //https://answers.unity.com/questions/1021048/unity-editor-inspector-delegate-function-pointer.html
    }