protected override void InitGameObject() { if (base.game_object == null) { base.game_object = Object.Instantiate(Resources.Load("Prefabs/enemy", typeof(GameObject))) as GameObject; } base.game_object.transform.position = new Vector3(Map_position_x, 0.1f, Map_position_y); game_object.renderer.material.color = ColourManager.toColor(MainColour); GameTools.Map.map_unit_occupy[Map_position_x, Map_position_y] = this; enemyAnimation = game_object.GetComponent <Animator> (); }
private void InitGameObject() { if (game_object == null) { game_object = Object.Instantiate(Resources.Load("Prefabs/Cube4", typeof(GameObject))) as GameObject; } game_object.transform.position = new Vector3(x, ((float)count) / 10.0f, y); Indicator script = game_object.GetComponent <Indicator>(); script.changeColour(ColourManager.toColor(spell.SpellColour)); }
public void init(Spell s, Vector3 initPos, Vector3 destPos) { this.s = s; this.initPos = initPos; this.destPos = destPos; foreach (Transform t in transform) { ProjectileCube pc = t.GetComponent <ProjectileCube>(); pc.changeColour(ColourManager.toColor(s.SpellColour)); } }
public void setSpellIndicator(int[] fromPosition, int[] toPosition, Spell spell) { if (!IsShowingIndicator) { for (int i = 0; i < refill; i++) { pool[i].transform.position = new Vector3(-100, i, 0); } return; } int[,] coordinates = spell.Shape.toCoords(fromPosition, toPosition); for (int i = 0; i < coordinates.GetLength(0); i++) { pool[i].transform.position = new Vector3(coordinates[i, 0], 0.02f, coordinates[i, 1]); Indicator script = pool[i].GetComponent <Indicator>(); script.changeColour(ColourManager.toColor(spell.SpellColour)); if (!MapTools.IsOutOfBounds(coordinates[i, 0], coordinates[i, 1]) && (GameTools.Map.map_unit_occupy[coordinates[i, 0], coordinates[i, 1]] != null || (GameTools.Player.Map_position_x == coordinates[i, 0] && GameTools.Player.Map_position_y == coordinates[i, 1]) || GameTools.Base.IsWithinBase(coordinates[i, 0], coordinates[i, 1]))) { if (!TilesToAnimate.Contains(i)) { TilesToAnimate.Add(i); } } else { if (TilesToAnimate.Contains(i)) { TilesToAnimate.Remove(i); } } } if (coordinates.GetLength(0) != 0) { refill = coordinates.GetLength(0); } if (RangeIndicator != null) { RangeIndicator.updateSpellCoOrds(coordinates); } }
public void GetHitByMagic(Spell taken_spell) { float modifier = 1.0f; if (Interaction == TileInteraction.Damage) { if (ColourManager.getWeakness(taken_spell.SpellColour) == MainColour) { //The spell is weak against our colour modifier = ColourManager.WeaknessModifier; } float dmg = taken_spell.Power * modifier; hp -= dmg; if (!IsDead()) { ShowText("HP remaining: " + hp, ColourManager.toColor(MainColour), 0); } } }