start of work on miniMap generation
-base structure of Tile script -object for tile prefab(without parametrs)
This commit is contained in:
BIN
Assets/Scenes/Game.unity
LFS
BIN
Assets/Scenes/Game.unity
LFS
Binary file not shown.
@@ -4,15 +4,73 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class Tile : MonoBehaviour
|
public class Tile : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public enum landscapeTypes { water, lowGround, midGround, highGround, mountain, uncrosableMountain };
|
||||||
|
public enum stateTypes { idle, occupied };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Vector2Int position;
|
||||||
|
public float noiseValue;
|
||||||
|
public Hex.landscapeTypes mapType;
|
||||||
|
|
||||||
|
public stateTypes state = stateTypes.idle;
|
||||||
|
|
||||||
|
//TODO ïåðåìåííàÿ äëÿ ïàìàòè ñîäåðæèìîãî
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeTile(Vector2Int pos, float noiseVal)
|
||||||
|
{
|
||||||
|
noiseValue = noiseVal;
|
||||||
|
position = pos;
|
||||||
|
//Debug.Log(noiseValue);
|
||||||
|
noiseValue = Mathf.Pow(noiseValue, 1.7f); //Óðåç÷åíèå ïåðåõîäîâ ëàíäøàôòà
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Âûíåñòè ýòè âåëå÷èíû â íàñòðîéêè
|
||||||
|
float waterLevel = 0.34f;
|
||||||
|
float landLevel = 0.4f;
|
||||||
|
float hillLevel = 0.6f;
|
||||||
|
float highHillLevel = 0.75f;
|
||||||
|
float mountainLevel = 0.95f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
InitializeTexture();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeTexture()
|
||||||
|
{
|
||||||
|
Color color = new Color(0, 0, 0, 0);
|
||||||
|
|
||||||
|
float pow = 1.2f; //ñòåïåíü â êîòîðóþ âîçâîäòèòñÿ øóì äëÿ äîïîëíèòåëüíîãî óðåç÷åíèÿ öâåòîâ'
|
||||||
|
|
||||||
|
float val = Mathf.Pow(noiseValue, pow);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GetComponent<SpriteRenderer>().color = color;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user