Initial commit
This commit is contained in:
63
Assets/scripts/cell.cs
Normal file
63
Assets/scripts/cell.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class cell : MonoBehaviour
|
||||
{
|
||||
public Vector2Int pos = new Vector2Int(0, 0);
|
||||
public float noiseValue;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
/*
|
||||
GetComponent<SpriteRenderer>().color = new Color(noiseValue, noiseValue, noiseValue, 1);
|
||||
noiseValue = Random.Range(0f, 1f);
|
||||
*/
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//Debug.Log(noiseValue);
|
||||
noiseValue = Mathf.Pow(noiseValue, 1.7f);
|
||||
|
||||
float pow = 1.2f;
|
||||
|
||||
Color color;
|
||||
if (noiseValue <= 0.35)
|
||||
{
|
||||
noiseValue = Mathf.Pow(noiseValue, pow);
|
||||
color = new Color(noiseValue*0.2f, noiseValue * 0.2f, noiseValue + 0.1f);//âîäà
|
||||
}
|
||||
else if (noiseValue <= 0.5)
|
||||
{
|
||||
noiseValue = Mathf.Pow(noiseValue, pow);
|
||||
color = new Color(noiseValue*0.4f, noiseValue+0.3f, noiseValue*0.4f);//íèçèíà
|
||||
}
|
||||
else if (noiseValue <= 0.8)
|
||||
{
|
||||
noiseValue = Mathf.Pow(noiseValue, pow);
|
||||
color = new Color(noiseValue * 0.2f, noiseValue + 0.3f, noiseValue * 0.2f);//ïîëå
|
||||
}
|
||||
else if (noiseValue <= 0.95)
|
||||
{
|
||||
noiseValue = Mathf.Pow(noiseValue, pow);
|
||||
color = new Color(noiseValue*0.8f + 0.1f, noiseValue * 0.4f, noiseValue * 0.2f);//ãîðû
|
||||
}
|
||||
else
|
||||
{
|
||||
noiseValue = Mathf.Pow(noiseValue, pow);
|
||||
color = new Color(noiseValue*0.6f + 0.0f, noiseValue * 0.1f, noiseValue * 0.0f);//íåïðîõîäèìûé ïèê
|
||||
}
|
||||
GetComponent<SpriteRenderer>().color = color;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user