using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace FaceOff { class Group { private int mCategory = -1; public int Category { get { return mCategory; } set { mCategory = value; cellOne.Category = value; cellTwo.Category = value; cellThree.Category = value; } } private bool correct = false; public bool Correct { get { return correct; } set { correct = value; } } private Cell cellOne ; public Cell CellOne { get { return cellOne; } set { cellOne = value; } } private Cell cellTwo; public Cell CellTwo { get { return cellTwo; } set { cellTwo = value; } } private Cell cellThree; public Cell CellThree { get { return cellThree; } set { cellThree = value; } } //time to wait for loading private float validateTime; public float ValidateTime { get { return validateTime; } set { validateTime = value; } } public void ApplyJitter(float jitter) { validateTime = GameConfig.ValidateTime + jitter; } public void setTextures(Texture2D tex, Texture2D tex2) { if (cellOne.Blank) { cellTwo.Texture = tex; cellTwo.Scale(); cellTwo.Placed = true; cellThree.Texture = tex2; cellThree.Scale(); cellThree.Placed = true; } if (CellTwo.Blank) { cellOne.Texture = tex; cellOne.Scale(); cellOne.Placed = true; cellThree.Texture = tex2; cellThree.Scale(); cellThree.Placed = true; } else if (cellThree.Blank) { cellOne.Texture = tex; cellOne.Scale(); cellOne.Placed = true; cellTwo.Texture = tex2; cellTwo.Scale(); cellTwo.Placed = true; } } public bool isPlaced() { bool retVal = false; //if all of the cells in a group are filled, then check to see if the categories are all equal if (cellOne.Placed == true && cellTwo.Placed == true && cellThree.Placed == true) { retVal = true; } return retVal; } public bool checkCorrect() { bool retVal = false; //if all of the cells in a group are filled, then check to see if the categories are all equal if(cellOne.Placed == true && cellTwo.Placed == true && cellThree.Placed == true) { //if the categories of the cells match, then the blank was filled correctly if (cellOne.Category == cellTwo.Category && cellOne.Category == cellThree.Category) { retVal = true; correct = true; cellOne.Answered = true; cellOne.AnimatingStar = false; cellTwo.Answered = true; cellTwo.AnimatingStar = false; cellThree.Answered = true; cellThree.AnimatingStar = false; } } return retVal; } public void setBlank(int blank, Texture2D tex) { switch (blank) { case 1: cellOne.Texture = tex; cellOne.Blank = true; cellOne.Placed = false; cellOne.Scale(); break; case 2: cellTwo.Texture = tex; cellTwo.Blank = true; cellTwo.Placed = false; cellTwo.Scale(); break; case 3: cellThree.Texture = tex; cellThree.Blank = true; cellThree.Placed = false; cellThree.Scale(); break; } } } }