void Start() { anim = GetComponent <Animator>(); maxHealth = currentHealth; if (randomise) { currentHorns = (Game.Elements)Random.Range(0, 3); currentWings = (Game.Elements)Random.Range(0, 3); currentTail = (Game.Elements)Random.Range(0, 3); currentColour = (Game.Colour)Random.Range(0, 3); } UpdateAttributes(); GameObject lifeHeart = Instantiate(Resources.Load("UI/Life Heart") as GameObject, Game.controller.HUD.transform); lifeHeart.GetComponent <HealthHUD> ().target = this; }
void SetTexture(SkinnedMeshRenderer mesh, Game.Elements element) { if (currentColour == Game.Colour.blue) { mesh.material.SetTexture("_MainTex", blueTextures[(int)element]); } if (currentColour == Game.Colour.green) { mesh.material.SetTexture("_MainTex", greenTextures[(int)element]); } if (currentColour == Game.Colour.red) { mesh.material.SetTexture("_MainTex", redTextures[(int)element]); } if (currentColour == Game.Colour.yellow) { mesh.material.SetTexture("_MainTex", yellowTextures[(int)element]); } }
public void AbsorbAttributes(DragonMain other) { if (currentHorns != other.currentHorns) { if (storedHorns == other.currentHorns) { hornsCount++; if (hornsCount == 3) { currentHorns = storedHorns; hornsCount = 0; } } else { storedHorns = other.currentHorns; hornsCount = 1; } } if (currentWings != other.currentWings) { if (storedWings == other.currentWings) { wingsCount++; if (wingsCount == 3) { currentWings = storedWings; wingsCount = 0; } } else { storedWings = other.currentWings; wingsCount = 1; } } if (currentTail != other.currentTail) { if (storedTail == other.currentTail) { tailCount++; if (tailCount == 3) { currentTail = storedTail; tailCount = 0; } } else { storedTail = other.currentTail; tailCount = 1; } } if (currentColour != other.currentColour) { if (storedColour == other.currentColour) { colourCount++; if (hornsCount == 3) { currentColour = storedColour; colourCount = 0; } } else { storedColour = other.currentColour; colourCount = 1; } } UpdateAttributes(); }