//taking in the colorstate and change every color related variables to corresponding color virtual protected void ChangePaintState(ColorState targetColor) { ColorDataPack curPack = mCM.GetColorDataPack(targetColor, gameObject.tag); myOwnerID = curPack.mPlayerID; mRenderer.material = curPack.mPaintMaterial; gameObject.layer = (int)Mathf.Log(curPack.mLayer.value, 2); myPaintState = curPack.mColorState; }
//change state function by passing a state by assigning the color on the main tower meshes override protected void ChangePaintState(ColorState targetColor) { ColorDataPack curPack = mCM.GetColorDataPack(targetColor, gameObject.tag); myOwnerID = curPack.mPlayerID; gameObject.layer = (int)Mathf.Log(curPack.mLayer.value, 2); myPaintState = curPack.mColorState; //paint the main meshes foreach (GameObject i in mainTowerMeshList) { i.GetComponent <Renderer>().material = curPack.mPaintMaterial; } if (isContested) { foreach (GameObject i in paintLevelIndicators) { i.GetComponent <Renderer>().material = curPack.mPaintMaterial; } } }