public void activate() { //selected = this; if (!tile) { Start(); } HexGenerator grid = GameObject.FindObjectOfType <HexGenerator>(); grid.all((tt => tt.overlay.sprite = null)); foreach (HexTile tt in tile.neighbors) { if (tt.type == 0) { tt.Select(); } } }
public void OnMouseDown() { HexGenerator grid = GameObject.FindObjectOfType <HexGenerator>(); if (overlay.sprite) { if (overlay.sprite == selected) { Pawn.selected.tile.occupier = null; Pawn.selected.tile = this; /*Pawn.selected.x = x; * Pawn.selected.y = y; * Pawn.selected.z = z;*/ occupier = Pawn.selected; Pawn.selected = null; } else if (overlay.sprite == attack) { GameObject.FindObjectOfType <InitiativeTracker>().remove(occupier); Animator Anim1 = occupier.GetComponentInChildren <Animator>(); Anim1.transform.parent = null; Anim1.Play("Die"); Destroy(occupier.gameObject); Pawn.selected.tile.occupier = null; Pawn.selected.tile = this; /*Pawn.selected.x = x; * Pawn.selected.y = y; * Pawn.selected.z = z;*/ occupier = Pawn.selected; Debug.Log("HAAA"); Debug.Log(occupier); Animator Anim2 = occupier.GetComponentInChildren <Animator>(); switch (occupier.GetComponentInChildren <BodyGenerator>().weapons.GetLabel()) { case "Bow": Anim2.Play("Attack Bow"); Debug.Log("ssAA"); break; case "Falchion": Anim2.Play("Attack Smasher"); Debug.Log("wwA"); break; case "Shield": Anim2.Play("Attack Blocker"); Debug.Log("aaaAA"); break; case "Spear": Anim2.Play("Attack Lancer"); Debug.Log("HsssAA"); break; default: Anim2.Play("Attack Brawler"); Debug.Log("fffA"); break; } occupier.attacking = true; Debug.Log(Anim2.GetCurrentAnimatorStateInfo(0).IsName("Idle")); Pawn.selected = null; } grid.all((t => t.overlay.sprite = null)); } else { throw new NullReferenceException("" + x + "," + y + "," + z); } //overlay.sprite = selected; /*foreach(HexTile t in neighbors) * { * t.overlay.sprite = selected; * } * /**/ /*for(int i = 2; i <= 4; i++) * { * if(grid.get(x, y + i, z - i)) * grid.get(x, y + i, z - i).overlay.sprite = selected; * if (grid.get(x + i, y - i, z)) * grid.get(x + i, y - i, z).overlay.sprite = selected; * if(grid.get(x + i, y, z - i)) * grid.get(x + i, y, z - i).overlay.sprite = selected; * if(grid.get(x, y - i, z + i)) * grid.get(x, y - i, z + i).overlay.sprite = selected; * if(grid.get(x - i, y + i, z)) * grid.get(x - i, y + i, z).overlay.sprite = selected; * if(grid.get(x - i, y, z + i)) * grid.get(x - i, y , z + i).overlay.sprite = selected; * } */ /*Debug. * Handles.Label(transform.position, x + "," + y + "," + z);*/ //Handles.Label(transform.position, "test"); }