Exemplo n.º 1
0
    /*public void attack(Trees target){
     *
     *      GameManager.curPlayer.clickedCard.calculateDirection (target.transform.position, true);
     *      target.receiveAttack(GameManager.curPlayer.clickedCard.getDamage());
     * }*/

    public void receiveAttack(int dmg)
    {
        hp -= dmg;
        Debug.Log("Was dealt " + dmg + " damage and is now at " + hp + " hp");

        if (hp <= 0)
        {
            Debug.Log("End Game");
            handler = new EndGame(this, player);
            handler.affect();
        }
    }
Exemplo n.º 2
0
    public void init(BattlePlayer player)
    {
        this.player = player;
        maxHP       = hp = 11;

        if (player.player1)           //Your name is pink
        //transform.Find ("NameText").GetComponent<TextMesh> ().text = this.player.playerName;
        {
            transform.Find("NameText").GetComponent <TextMesh> ().color = Color.magenta;
        }
        else             //Enemy name is red
                         //transform.Find ("NameText").GetComponent<TextMesh> ().text = this.player.playerName;
        {
            transform.Find("NameText").GetComponent <TextMesh>().color = Color.red;
        }
        handler            = new LivingTreeClick(this, player);
        transform.position = new Vector3(player.TreePos.x, player.TreePos.y, player.TreePos.z);
    }