// TEMP: activated when EndTurnAction is received. public void startTurn() { player1.isActive = true; player2.isActive = false; //Deal player 1 a card and set as current player GameManager.curPlayer = player1; player1.startTurn(); }
//Initialization for a card and sets it's position to (1000, 1000, 1000) public void init(BattlePlayer player, int cardID, int diet, int level, int attack, int health, string species_name, string type, string description) { this.player = player; this.cardID = cardID; this.manaCost = level; this.transform.position = new Vector3(player.DeckPos.x, player.DeckPos.y, player.DeckPos.z); canAttackNow = true; velocity = 0; terminalVelocity = 6000; distance = 0; delayTimer = 0; name = species_name; this.diet = getDietType(diet); this.dietNum = diet; this.level = level; maxHP = hp = health; naturalDmg = dmg = attack; //this.type = type; //hide temporarily //this.description = description; //hide temporarily Debug.Log("diet" + diet); //0-omnivore, 1-carnivore, 2-herbivore, 3-spell Texture2D cardTexture = (Texture2D)Resources.Load("Images/Battle/cardfront" + (int)this.diet, typeof(Texture2D)); Texture2D speciesTexture = (Texture2D)Resources.Load("Images/" + this.name, typeof(Texture2D)); //Changing cardfront texture GetComponent <Renderer>().material.mainTexture = cardTexture; transform.Find("CardArt").GetComponent <MeshRenderer> ().material.mainTexture = speciesTexture; //Changing card text // Color gold = new Color (209f, 234f, 50f, 255f); transform.Find("NameText").GetComponent <TextMesh> ().text = TextWrap(this.name, 16); transform.Find("TypeText").GetComponent <TextMesh> ().text = this.type; transform.Find("TypeText").GetComponent <MeshRenderer> ().material.color = Color.white; transform.Find("DescriptionText").GetComponent <TextMesh> ().text = TextWrap(this.description, 26); transform.Find("DescriptionText").GetComponent <MeshRenderer> ().material.color = Color.white; transform.Find("LevelText").GetComponent <TextMesh> ().text = "" + this.level; transform.Find("LevelText").GetComponent <MeshRenderer> ().material.color = Color.white; transform.Find("DoneText").GetComponent <MeshRenderer> ().material.color = Color.red; transform.Find("DamageText").GetComponent <TextMesh> ().text = ""; transform.Find("DamageText").GetComponent <MeshRenderer> ().material.color = Color.red; //Initializes off screen transform.position = new Vector3(1000, 1000, 1000); //rotate facedown if player 2 if (!player.player1 && !Constants.SINGLE_PLAYER) { transform.rotation = new Quaternion(180, 0, 0, 0); } }
public static void endTurn() { // If two_player, only switch turns if player1 isActive if (!Constants.SINGLE_PLAYER && player1.isActive) { protocols.sendEndTurn(player1.playerID); //Player's endturn refreshes the player's minions so they can attack next turn. player1.endTurn(); // Not sure if this needs to be here player2.endTurn(); player2.isActive = true; player2.addMana(); if (player2.hand.Count != 5) { player2.dealDummyCard(1); } } if (Constants.SINGLE_PLAYER) { //Player's endturn refreshes the player's minions so they can attack next turn. player1.endTurn(); // Not sure if this needs to be here player2.endTurn(); //PLAYER 1'S TURN ENDING if (player1.isActive) { //the isActive variables switching for next turn player1.isActive = false; player2.isActive = true; //Sets the current player to player 2 and deals a card GameManager.curPlayer = player2; player2.startTurn(); //PLAYER 2'S TURN ENDING } else { //Player 1 is active, Player 2 unactive now player1.isActive = true; player2.isActive = false; //Deal player 1 a card and set as current player GameManager.curPlayer = player1; player1.startTurn(); } } // End if SinglePlayer }
public static void endTurn() { // If two_player, only switch turns if player1 isActive if (!Constants.SINGLE_PLAYER && player1.isActive) { protocols.sendEndTurn (player1.playerID); //Player's endturn refreshes the player's minions so they can attack next turn. player1.endTurn (); // Not sure if this needs to be here player2.endTurn (); player2.isActive = true; player2.addMana (); if (player2.hand.Count != 5) { player2.dealDummyCard (1); } } if (Constants.SINGLE_PLAYER) { //Player's endturn refreshes the player's minions so they can attack next turn. player1.endTurn (); // Not sure if this needs to be here player2.endTurn (); //PLAYER 1'S TURN ENDING if (player1.isActive) { //the isActive variables switching for next turn player1.isActive = false; player2.isActive = true; //Sets the current player to player 2 and deals a card GameManager.curPlayer = player2; player2.startTurn (); //PLAYER 2'S TURN ENDING } else { //Player 1 is active, Player 2 unactive now player1.isActive = true; player2.isActive = false; //Deal player 1 a card and set as current player GameManager.curPlayer = player1; player1.startTurn (); } }// End if SinglePlayer }
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; } //Set dmg text transform.Find("DamageText").GetComponent<TextMesh>().text = ""; //Set alpha level for fading //transform.Find ("DamageText").GetComponent<TextMesh> ().color.a = 0; handler = new LivingTreeClick(this, player); transform.position = new Vector3(player.TreePos.x, player.TreePos.y, player.TreePos.z); }
void Start() { // Needed to to fade into scene Game.StartEnterTransition(); showLoading = 300; //5 seconds popup = GameObject.Find("Loading"); protocols = (ProtocolManager)gameObject.AddComponent <ProtocolManager>(); protocols.init(); enabled = true; player1 = (BattlePlayer)gameObject.AddComponent <BattlePlayer>(); player1.init(true); player1.playerID = GameState.player.GetID(); Debug.Log("player1 ID : " + player1.playerID); player1.playerName = GameState.player.GetName(); // initialize match here if (Constants.SINGLE_PLAYER) { player2 = (BattlePlayer)gameObject.AddComponent <BattlePlayer>(); player2.init(false); player2.playerName = "Player 2"; } else { // TODO: Need different logic here to make player 2 // not have cards dealt face up, etx. player2 = (BattlePlayer)gameObject.AddComponent <BattlePlayer>(); player2.init(false); player2.playerName = "Player 2"; } // Send MatchStatus protocol initMatch(); curPlayer = player1; GameManager.manager = this; // Poll for turn updates //StartCoroutine(PollAction(Constants.UPDATE_RATE)); }
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; } //Set dmg text transform.Find("DamageText").GetComponent <TextMesh>().text = ""; //Set alpha level for fading //transform.Find ("DamageText").GetComponent<TextMesh> ().color.a = 0; handler = new LivingTreeClick(this, player); transform.position = new Vector3(player.TreePos.x, player.TreePos.y, player.TreePos.z); }
public override void affect() { BattlePlayer currentPlayer = GameManager.curPlayer; if (currentPlayer.clickedCard == null && player.isActive && card.canAttack()) { player.clickedCard = card; if (player.player1) { Debug.Log("Player 1 is ready to attack"); } else { Debug.Log("Player 2 is ready to attack"); } } else if (currentPlayer != player && currentPlayer.clickedCard != null && currentPlayer.clickedCard.diet != AbstractCard.DIET.HERBIVORE) { currentPlayer.targetCard = card; bool attackback = false; if (currentPlayer.targetCard.diet != AbstractCard.DIET.HERBIVORE) { attackback = true; } currentPlayer.clickedCard.attack(currentPlayer.clickedCard, currentPlayer.targetCard, attackback); currentPlayer.getProtocolManager().sendCardAttack(currentPlayer.playerID, currentPlayer.clickedCard.fieldIndex, currentPlayer.targetCard.fieldIndex); currentPlayer.clickedCard = null; currentPlayer.targetCard = null; } if (currentPlayer.clickedCard != null && currentPlayer == player && card != currentPlayer.clickedCard) { currentPlayer.clickedCard = null; } }
public InPlay(AbstractCard card, BattlePlayer player) : base(card, player) { }
public InHand(AbstractCard card, BattlePlayer player) : base(card, player) { }
public EndGame(Trees tree, BattlePlayer player) : base(tree, player) { }
public AbstractCardHandler(AbstractCard card, BattlePlayer player) { this.card = card; this.player = player; }
public LivingTreeClick(Trees tree, BattlePlayer player) : base(tree, player) { }
public RemoveFromPlay(AbstractCard card, BattlePlayer player) : base(card, player) { }
public TreesHandler(Trees tree, BattlePlayer player) { this.tree = tree; this.player = player; }
void Start() { // Needed to to fade into scene Game.StartEnterTransition (); showLoading = 300; //5 seconds popup = GameObject.Find ("Loading"); protocols = (ProtocolManager)gameObject.AddComponent ("ProtocolManager"); protocols.init (); enabled = true; player1 = (BattlePlayer)gameObject.AddComponent ("BattlePlayer"); player1.init (true); player1.playerID = GameState.player.GetID (); Debug.Log ("player1 ID : " + player1.playerID); player1.playerName = GameState.player.GetName (); // initialize match here if (Constants.SINGLE_PLAYER) { player2 = (BattlePlayer)gameObject.AddComponent ("BattlePlayer"); player2.init (false); player2.playerName = "Player 2"; } else { // TODO: Need different logic here to make player 2 // not have cards dealt face up, etx. player2 = (BattlePlayer)gameObject.AddComponent ("BattlePlayer"); player2.init (false); player2.playerName = "Player 2"; } // Send MatchStatus protocol initMatch (); curPlayer = player1; GameManager.manager = this; // Poll for turn updates //StartCoroutine(PollAction(Constants.UPDATE_RATE)); }
// TEMP: activated when EndTurnAction is received. public void startTurn() { player1.isActive = true; player2.isActive = false; //Deal player 1 a card and set as current player GameManager.curPlayer = player1; player1.startTurn (); }
//Initialization for a card and sets it's position to (1000, 1000, 1000) public void init(BattlePlayer player, int cardID, int diet, int level, int attack, int health, string species_name, string type, string description) { this.player = player; this.cardID = cardID; this.manaCost = level; this.transform.position = new Vector3 (player.DeckPos.x, player.DeckPos.y, player.DeckPos.z); canAttackNow = true; velocity = 0; terminalVelocity = 6000; distance = 0; delayTimer = 0; name = species_name; this.diet = getDietType (diet); this.dietNum = diet; this.level = level; maxHP = hp = health; naturalDmg = dmg = attack; //this.type = type; //hide temporarily //this.description = description; //hide temporarily Debug.Log ("diet" + diet); //0-omnivore, 1-carnivore, 2-herbivore, 3-spell Texture2D cardTexture = (Texture2D)Resources.Load ("Images/Battle/cardfront" + (int)this.diet, typeof(Texture2D)); Texture2D speciesTexture = (Texture2D)Resources.Load ("Images/" + this.name, typeof(Texture2D)); //Changing cardfront texture renderer.material.mainTexture = cardTexture; transform.Find ("CardArt").GetComponent<MeshRenderer> ().material.mainTexture = speciesTexture; //Changing card text // Color gold = new Color (209f, 234f, 50f, 255f); transform.Find ("NameText").GetComponent<TextMesh> ().text = TextWrap (this.name, 16); transform.Find ("TypeText").GetComponent<TextMesh> ().text = this.type; transform.Find ("TypeText").GetComponent<MeshRenderer> ().material.color = Color.white; transform.Find ("DescriptionText").GetComponent<TextMesh> ().text = TextWrap (this.description, 26); transform.Find ("DescriptionText").GetComponent<MeshRenderer> ().material.color = Color.white; transform.Find ("LevelText").GetComponent<TextMesh> ().text = "" + this.level; transform.Find ("LevelText").GetComponent<MeshRenderer> ().material.color = Color.white; transform.Find ("DoneText").GetComponent<MeshRenderer> ().material.color = Color.red; transform.Find ("DamageText").GetComponent<TextMesh> ().text = ""; transform.Find ("DamageText").GetComponent<MeshRenderer> ().material.color = Color.red; //Initializes off screen transform.position = new Vector3 (1000, 1000, 1000); //rotate facedown if player 2 if (!player.player1 && !Constants.SINGLE_PLAYER) { transform.rotation = new Quaternion (180, 0, 0, 0); } }