public void UpdateTile(Vector2 pd) { if (pd != Vector2.zero) { Board.BoardTile x = null; if (pd == Vector2.left) { x = board.Left(curr_tile); } else if (pd == Vector2.right) { x = board.Right(curr_tile); } else if (pd == Vector2.up) { x = board.Up(curr_tile); } else if (pd == Vector2.down) { x = board.Down(curr_tile); } if (x != null) { curr_tile = x; this.transform.position = curr_tile.getPosition(); } } }
private void OnTriggerEnter2D(Collider2D other) { //crash into wall if (other.tag == "Wall") { Destroy(gameObject); return; } if (other.tag == "WallTile") { int remaining_hits = other.GetComponent <WallTileBreaking>().DamageWall(); if (remaining_hits == 0) { Board.BoardTile wallT = board.PositionToTile(other.transform.position); board.replaceTile(wallT, "Default"); } Destroy(gameObject); return; } //inflict damage on Player here if ((other.tag == "Right" && leftPlayer) || (other.tag == "Left" && !leftPlayer)) { Destroy(gameObject); other.GetComponent <Player>().TakeDamage(base_damage * damage_multiplier, false); } }
public void startFlash(Board b, Player player, int secondsDelay, Board.BoardTile targetTile, string formation, string replaceTypeString) { board = b; this.player = player; pointed_tile = targetTile; form = formation; typeReplace = replaceTypeString; affectedTiles = b.ReplaceFormationTiles(targetTile, formation, "Flash", ""); Invoke("finishFlash", secondsDelay); }
public bool damageWall(BoardTile tile) { GameObject walltile = tileCorrespondingObject(tile); for (int i = 0; i < k; i++) { int remaining_hits = walltile.GetComponent <WallTileBreaking>().DamageWall(); if (remaining_hits == 0) { Board.BoardTile wallT = this.PositionToTile(walltile.transform.position); this.replaceTile(wallT, "Default"); return(true); } } return(false); }
private void spawnRandomSunlight(bool playerLeft) { if (!on) { return; } int randomX; int randomY; //calculate random indices Random.seed = System.DateTime.Now.Millisecond; if (playerLeft) { randomX = Random.Range(0, leftOffset); randomY = Random.Range(0, boardHeight); } else { randomX = Random.Range(leftOffset, leftOffset + rightOffset); randomY = Random.Range(0, boardHeight); } Board.BoardTile curTile = board.IndexToTile(randomX, randomY); //if sunlight cannot be accessed by anyone, retry while (curTile.getWalkable() == -1) { Random.seed += 1; if (playerLeft) { randomX = Random.Range(0, leftOffset); randomY = Random.Range(0, boardHeight); } else { randomX = Random.Range(leftOffset, leftOffset + rightOffset); randomY = Random.Range(0, boardHeight); } curTile = board.IndexToTile(randomX, randomY); } Vector2 curPos = curTile.getPosition(); Instantiate(sunlighttoken, new Vector3(curPos.x, curPos.y, -1), Quaternion.identity); }
public void RestoreFormationTiles(List <Board.BoardTile> tilesToDeflash, Board.BoardTile targetTile, string replaceTileString) { foreach (Board.BoardTile curActiveFlashTile in tilesToDeflash) { //if a player is sitting on the selected tile, you cannot change that tile to be a wall, to avoid having players be stuck in walls //therefore if we are trying to replace walls, replace with dirt instead bool p_on_wall_tile = (replaceTileString == "Wall") && ((curActiveFlashTile == leftPlayerTile) || (curActiveFlashTile == rightPlayerTile)); if (!p_on_wall_tile) { //if wall do nothing, cannot cause flash on wall tile if (curActiveFlashTile.curTileType() == "Wall") { //Debug.Log("wall detected"); } else { replaceTile(curActiveFlashTile, replaceTileString); } //} else { //} } else { if (curActiveFlashTile.curTileType() == "Flash") { replaceTile(curActiveFlashTile, "Dirt"); } } } if (replaceTileString != null) { if (replaceTileString == "Wall") { // //replaceTile(targetTile, "Dirt"); //replaceTile(targetTile, replaceTileString); } else { replaceTile(targetTile, replaceTileString); } } }
public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { control.lSunlightCtr -= sunlightCost; startFlash(board, player, 0.1f, pointed_tile, formation, "Dirt"); } if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { control.rSunlightCtr -= sunlightCost; startFlash(board, player, 0.1f, pointed_tile, formation, "Dirt"); } }
// Start is called before the first frame update public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { buff(player); control.lSunlightCtr -= sunlightCost; } if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { buff(player); control.rSunlightCtr -= sunlightCost; } player.playSound("Upgrade"); }
// Start is called before the first frame update public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { bool worked = board.replaceTileWithWall(pointed_tile); if (worked) { control.lSunlightCtr -= sunlightCost; } } else if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { bool worked = board.replaceTileWithWall(pointed_tile); if (worked) { control.rSunlightCtr -= sunlightCost; } } }
// Start is called before the first frame update public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { player.attackStat *= (1.0f + (damageBoostPercent / 100.0f)); control.lSunlightCtr -= sunlightCost; } if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { player.attackStat *= (1.0f + (damageBoostPercent / 100.0f)); control.rSunlightCtr -= sunlightCost; } }
public abstract void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null);
private void Awake() { board = GameObject.Find("GameBoard").GetComponent <Board>(); curr_tile = board.PositionToTile(this.transform.position); }
public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { //player.activateSword(); }
// Start is called before the first frame update public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (pointed_tile == null) { //Debug.Log("ah f**k"); } if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { control.lSunlightCtr -= sunlightCost; board.replaceTile(pointed_tile, "Lava"); } else if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { control.rSunlightCtr -= sunlightCost; board.replaceTile(pointed_tile, "Lava"); } }
// Start is called before the first frame update public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= sunlightCost) { buff(player); control.lSunlightCtr -= sunlightCost; dPlayer = player; Invoke("debuff", 5.0f); } if (!player.leftPlayer && control.rSunlightCtr >= sunlightCost) { buff(player); control.rSunlightCtr -= sunlightCost; dPlayer = player; Invoke("debuff", 5.0f); } }
public override void Activate(Player player, GameManager control, Board board, Vector2 aim_dir = new Vector2(), Board.BoardTile pointed_tile = null) { if (player.leftPlayer && control.lSunlightCtr >= SunlightCost) { player.TakeDamage(-1 * (healPercent / 100.0f), true); control.lSunlightCtr -= SunlightCost; } if (!player.leftPlayer && control.rSunlightCtr >= SunlightCost) { player.TakeDamage(-1 * (healPercent / 100.0f), true); control.rSunlightCtr -= SunlightCost; } }