void Awake() { thisPosition.x = transform.position.x; thisPosition.y = transform.position.y; build = FindObjectOfType <BuildSettings>(); gc = FindObjectOfType <GlobalController>(); col = GetComponent <BoxCollider2D>(); sprite = GetComponent <SpriteRenderer>(); build.SetPlayerSpawn(thisPosition); }
void Update() { thisPosition.x = transform.position.x; thisPosition.y = transform.position.y; if (thisPosition != build.GetPlayerSpawn()) { build.SetPlayerSpawn(thisPosition); } //hide any collisions/graphics if (!gc.GetIsBuilding()) { sprite.enabled = false; col.enabled = false; } else if (gc.GetIsBuilding()) { sprite.enabled = true; col.enabled = true; } }