void Awake() { sr = GetComponent <SpriteRenderer>(); tilemap = GetComponentInParent <Tilemap>(); piping = GetComponentInParent <Piping>(); sprites = normalSprites; }
void Start() { sr = GetComponent <SpriteRenderer>(); tilemap = GetComponentInParent <Tilemap>(); piping = GetComponentInParent <Piping>(); SetupPathingAndSprite(); materialRegularWater = sr.material; colorRegularWater = sr.color; ChangeMaterialHotWaterPipe(); }
void Awake() { sr = GetComponent <SpriteRenderer>(); tilemap = GetComponentInParent <Tilemap>(); piping = GetComponentInParent <Piping>(); if (hotWaterDirs.Count != 0) { sprites = heaterSprites; } else { sprites = normalSprites; } }
public void reloadConnections() { //TODO use job system for this Debug.Log("reloading Connections for: " + this.gameObject); List <GameObject> available = Piping.getInRange(20.0f, this.transform); clearPipes(); //Debug.Log("available: " + available); sortListByPriority(available); foreach (GameObject energyTarget in available) { if (connections.Contains(energyTarget.GetComponent <EnergyContainer>()) || inNetwork(energyTarget.GetComponent <EnergyContainer>()) || energyTarget.GetComponent <Structure>().isSalvaging()) { continue; } else { connections.Add(energyTarget.GetComponent <EnergyContainer>()); energyTarget.GetComponent <EnergyContainer>().addConnection(this); Piping.createPipes(this.transform, energyTarget.transform, pipeObjects); if (network == null && energyTarget.GetComponent <EnergyContainer>().getNetwork() == null) { createNetwork(energyTarget.GetComponent <EnergyContainer>()); energyTarget.GetComponent <EnergyContainer>().setNetwork(network); } else if (network == null) { Debug.Log("found existing energy network, adding self"); this.setNetwork(energyTarget.GetComponent <EnergyContainer>().getNetwork()); //network.Add(this); } else { energyTarget.GetComponent <EnergyContainer>().setNetwork(network); } } } }