예제 #1
0
    public PharoahDie GetChildAsDie()
    {
        GameObject childGO = this.myChild;
        PharoahDie die     = childGO.GetComponent <PharoahDie>();

        return(die);
    }
예제 #2
0
    public bool AddPip(PharoahDie die)
    {
        if (!die.isActiveDie())
        {
            GameState.Message("Cannot use Scarab on non-active die.");
            return(false);
        }
        int val = die.GetValue();

        if (val + 1 > die.MaxValue())
        {
            GameState.Message("Cannot AddPip beyond die's max value of " + die.MaxValue().ToString());
            return(false);
        }

        GameState.Message("Adding Pip to " + die.name);
        val++;
        if (val >= die.MaxValue())
        {
            val = die.MaxValue();
        }
        die.SetDie(val);
        isConsumed = true;
        return(true);
    }
예제 #3
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
    //  player has chosen a die
    public void ChooseDie(PharoahDie die)
    {
        pgs.UndoState();                                //  go back to previous state before WaitingToSelectDie
        bool bSuccessfulDieChosen = pgs.ChooseDie(die); //  calls OnDieSelect delegate. For scarabs, this will reroll or addpip. For TileAbility, it will call the ability's delegate, if any

        if (bSuccessfulDieChosen)
        {
            //  this should be made generic for all TileAbility
            if (this.curScarabInUse && this.curScarabInUse.isConsumed)
            {
                Destroy(this.curScarabInUse.gameObject);    //  destroy the scarab after we've rolled/added pip to the die.
                this.curScarabInUse = null;
            }

            //  This will fire the trigger from the player's point of view. The die chosen should be saved by the delegate in ChooseDie
            if (this.curTileInUse)
            {
                this.curTileInUse.FireTrigger(TileAbility.PlayerTurnStateTriggers.ChooseDie, this);
            }
        }
        else//  we were not able to select a valid die
        {
            if (this.curScarabInUse)
            {
                //  return the scarab back to our list without consuming it
                scarabList.Add(this.curScarabInUse);
                PlayerBoardAllUI.RefreshScarabUI();
                this.curScarabInUse = null;
            }
        }
    }
예제 #4
0
 public override void OnStartTurn(PlayerBoard plr)
 {
     base.OnStartTurn(plr);
     this.isUsedThisTurn            = false; //  refresh this every turn.
     hasBeenActivatedBySpecificRoll = false;
     curDie = null;
     adjustedDice.Clear();
 }
예제 #5
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
    //  =============================================================================

    //	add a new die to myself
    public PharoahDie AddDie(DiceFactory.DieType dieType)
    {
        PharoahDie die = GameState.GetCurrentGameState().diceFactory.NewDie(dieType);

        diceList.Add(die);
        die.ReadyToRoll();
        return(die);
    }
예제 #6
0
    public PharoahDie NewDie(DieType dieType)
    {
        PharoahDie newDie = GameObject.Instantiate(prefabDice[(int)dieType]);

        if (newDie.isSetDie())
        {
            newDie.MoveToSetDieArea();
        }
        return(newDie);
    }
예제 #7
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
    public void EndTurn()
    {
        GameState.Message(this.name + " turn has ended");
        this.gameObject.SetActive(false);

        //  End of Turn Triggers
        foreach (Tile tile in tileList)
        {
            TileAbility ability = tile.GetComponent <TileAbility>();
            if (ability)
            {
                //  Herder ability. If the player has locked a pair, then give the player a die for the remainder of the turn.
                if (ability.onStateTrigger == TileAbility.PlayerTurnStateTriggers.LockedAny)
                {
                }
            }
        }

        //  remove all temporary tiles.
        RemoveAllTempTiles();

        //  for all dice - remove all temporary dice
        for (int ii = diceList.Count - 1; ii >= 0; ii--)    //  reverse remove so we don't get weird list problems
        {
            PharoahDie d6 = diceList[ii];
            if (d6.isTemporary())       //  remove temporary dice
            {
                diceList.RemoveAt(ii);  //  take this die out of this list
                Destroy(d6.gameObject); //    destroy this whole die.
            }
        }

        /*
         * foreach (PharoahDie d6 in diceList)
         * {
         *  if (d6.isTemporary())   //  remove temporary dice
         *  {
         *      diceList.Remove(d6);
         *      Destroy(d6.gameObject);
         *  }
         * }
         */
        //  for all dice - reset all permanent dice
        foreach (PharoahDie d6 in diceList)
        {
            d6.ReadyToRoll();
            d6.EndTurn();
            d6.transform.parent = this.transform;
        }
        foreach (Tile tile in tileList)
        {
            tile.canUndo = false;
        }
        pgs.SetState(PlayerGameState.PlayerGameStates.WaitingNextTurn);
    }
예제 #8
0
 //  selecting a die
 public bool ChooseDie(PharoahDie die)
 {
     bool bSuccess = false;
     if (OnDieSelect != null)
     {
         bSuccess = OnDieSelect(die);
         if (bSuccess)
          curDie = die;
     }
     return bSuccess;
 }
예제 #9
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 //  roll a single die
 public bool RollDie(PharoahDie die)
 {
     if (die == null)
     {
         return(false);
     }
     GameState.GetCurrentGameState().purchaseBoard.SetState(PurchaseBoard.PurchaseBoardState.isTuckedAway);
     UnhideDice();
     DiceCup.StartRolling();
     die.ReadyToRoll();
     die.RollDie();
     return(true);
 }
예제 #10
0
    //  get the first die that is not the specified one.
    PharoahDie GetOtherDie(PharoahDie notThisDie)
    {
        PharoahDie theDie = null;

        foreach (PharoahDie die in adjustedDice)
        {
            if (die != notThisDie)
            {
                theDie = die;
                return(theDie);
            }
        }
        return(theDie);
    }
예제 #11
0
    //  selecting a die
    public bool ChooseDie(PharoahDie die)
    {
        bool bSuccess = false;

        if (OnDieSelect != null)
        {
            bSuccess = OnDieSelect(die);
            if (bSuccess)
            {
                curDie = die;
            }
        }
        return(bSuccess);
    }
예제 #12
0
파일: Scarab.cs 프로젝트: euming/FotP
 public bool Reroll(PharoahDie die)
 {
     if (!die.isActiveDie())
     {
         GameState.Message("Cannot use Scarab on non-active die.");
         return false;
     }
     GameState.Message("Rerolling " + die.name);
     DiceCup.StartRolling();
     die.ReadyToRoll();
     die.RollDie();
     isConsumed = true;
     return true;
 }
예제 #13
0
 public bool Reroll(PharoahDie die)
 {
     if (!die.isActiveDie())
     {
         GameState.Message("Cannot use Scarab on non-active die.");
         return(false);
     }
     GameState.Message("Rerolling " + die.name);
     DiceCup.StartRolling();
     die.ReadyToRoll();
     die.RollDie();
     isConsumed = true;
     return(true);
 }
예제 #14
0
파일: GetDie.cs 프로젝트: euming/FotP
    //  get a new die that is ready to roll immediately
    PharoahDie GetNewDie(PlayerBoard plr)
    {
        PharoahDie die = plr.AddDie(type);

        myDie = die;    //  remember the die that this tileAbility bought. We may need to do something with it later.
        if (setDieValue > 0)
        {
            die.MakeSetDie(setDieValue);
        }
        if (isTemporary)
        {
            die.MakeTemporary();
        }

        return(die);
    }
예제 #15
0
    bool OnCancel(PharoahDie d)
    {
        bool bSuccess = false;

        this.isUsedThisTurn = false;
        this.isUsedThisRoll = false;
        GameState.Message("Cancel");
        foreach (PharoahDie die in adjustedDice)
        {
            die.UndoTempPips();
            bSuccess = true;
        }
        myPlayer.UndoState();   //  go back to previous state
        UIState.EnableCancelButton(false);
        UIState.EnableDoneButton(false);
        return(bSuccess);
    }
예제 #16
0
파일: GameState.cs 프로젝트: euming/FotP
    public List <PharoahDie> GetLockedDiceList()
    {
        List <PharoahDie> diceList = new List <PharoahDie>();

        foreach (DieSlot ds in lockedDiceSlots)
        {
            if (!ds.isEmpty())
            {
                if (ds.GetChildAsDie() != null)
                {
                    diceList.Add(ds.GetChildAsDie());
                }
            }
        }
        PharoahDie.SortList(diceList);
        return(diceList);
    }
예제 #17
0
    bool OnDone(PharoahDie d)
    {
        bool bSuccess = false;

        GameState.Message("Done");
        hasBeenActivatedBySpecificRoll = false; //  deactivate this die ability when done.
        foreach (PharoahDie die in adjustedDice)
        {
            die.FinalizeTempPips();
            bSuccess = true;
        }
        myPlayer.UndoState();   //  go back to previous state
        UIState.EnableCancelButton(false);
        UIState.EnableDoneButton(false);
        this.isUsedThisTurn = true;
        this.isUsedThisRoll = true;
        return(bSuccess);
    }
예제 #18
0
파일: AddPips.cs 프로젝트: euming/FotP
    public override void OnSelect(PlayerBoard plr)
    {
        base.OnSelect(plr);
        if (this.isUsedThisTurn && this.onlyOneUsePerTurn)
        {
            GameState.Message("Already used " + this.name + "\nduring this turn.");
            return;
        }
        if (this.isUsedThisRoll)
        {
            GameState.Message("Already used " + this.name + "\nduring this roll.");
            return;

        }
        //  sometimes, this is a DieAbility rather than a TileAbility.  SOme die abilities only are allowed on certain rolls of that die.
        if (specificRoll > 0)
        {
            if (this.myDie != null)
            {
                if (this.myDie.GetValue() != specificRoll)
                {
                    GameState.Message("Die " + this.myDie.name + " must be " + specificRoll.ToString() + " to use this ability.\n");
                    return;
                }
            }
        }
        curDie = null;
        adjustedDice.Clear();
        if (nDice == -1)
        {
            actualNumDice = plr.GetNumValidDice(onlyFor);
        }
        else
        {
            actualNumDice = nDice;
        }
        myPlayer = plr;
        plr.SetTileInUse(this.GetComponent<Tile>());
        plr.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
        plr.AskToChooseCancel(this.OnCancel);
        plr.AskToChooseDone(this.OnDone);
    }
예제 #19
0
 public override void OnSelect(PlayerBoard plr)
 {
     base.OnSelect(plr);
     if (this.isUsedThisTurn && this.onlyOneUsePerTurn)
     {
         GameState.Message("Already used " + this.name + "\nduring this turn.");
         return;
     }
     if (this.isUsedThisRoll)
     {
         GameState.Message("Already used " + this.name + "\nduring this roll.");
         return;
     }
     //  sometimes, this is a DieAbility rather than a TileAbility.  SOme die abilities only are allowed on certain rolls of that die.
     if (specificRoll > 0)
     {
         if (this.myDie != null)
         {
             if (this.myDie.GetValue() != specificRoll)
             {
                 GameState.Message("Die " + this.myDie.name + " must be " + specificRoll.ToString() + " to use this ability.\n");
                 return;
             }
         }
     }
     curDie = null;
     adjustedDice.Clear();
     if (nDice == -1)
     {
         actualNumDice = plr.GetNumValidDice(onlyFor);
     }
     else
     {
         actualNumDice = nDice;
     }
     myPlayer = plr;
     plr.SetTileInUse(this.GetComponent <Tile>());
     plr.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
     plr.AskToChooseCancel(this.OnCancel);
     plr.AskToChooseDone(this.OnDone);
 }
예제 #20
0
파일: Scarab.cs 프로젝트: euming/FotP
    public bool AddPip(PharoahDie die)
    {
        if (!die.isActiveDie())
        {
            GameState.Message("Cannot use Scarab on non-active die.");
            return false;
        }
        int val = die.GetValue();
        if (val+1 > die.MaxValue()) {
            GameState.Message("Cannot AddPip beyond die's max value of " + die.MaxValue().ToString());
            return false;
        }

        GameState.Message("Adding Pip to " + die.name);
        val++;
        if (val >= die.MaxValue())
            val = die.MaxValue();
        die.SetDie(val);
        isConsumed = true;
        return true;
    }
예제 #21
0
파일: ScarabUI.cs 프로젝트: euming/FotP
    bool SetState(ScarabUIState newState)
    {
        bool bSuccess = false;

        switch (newState)
        {
        default:
        case ScarabUIState.ready:
            selectedDie = null;
            bSuccess    = true;
            SetNumScarabsUI();
            break;

        //  try to use the scarab
        case ScarabUIState.scarab_activated:
            //  set aside the scarab for use
            if (GameState.GetCurrentGameState().currentPlayer.UseScarab(type))
            {
                if (SetState(ScarabUIState.waiting_die_select))
                {
                    bSuccess = true;
                    newState = ScarabUIState.waiting_die_select;
                }
            }
            break;

        case ScarabUIState.waiting_die_select:
            //GameState.GetCurrentGameState().currentPlayer.AskToChooseDie(this.type.ToString());
            //GameState.Message(this.name + " please select a die for scarab action");
            bSuccess = true;
            break;
        }
        if (bSuccess)
        {
            scuiState = newState;
        }
        return(bSuccess);
    }
예제 #22
0
파일: AddPips.cs 프로젝트: euming/FotP
 bool isNewDie(PharoahDie die)
 {
     return (!adjustedDice.Contains(die));
 }
예제 #23
0
파일: AddPips.cs 프로젝트: euming/FotP
 //  get the first die that is not the specified one.
 PharoahDie GetOtherDie(PharoahDie notThisDie)
 {
     PharoahDie theDie = null;
     foreach (PharoahDie die in adjustedDice)
     {
         if (die != notThisDie)
         {
             theDie = die;
             return theDie;
         }
     }
     return theDie;
 }
예제 #24
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 public void GiveHerderDie(PharoahDie die)
 {
     bHasExtraHerderDie = true;
     pgs.mayRollDice = true; //  if we JUST got a herder die, we are always allowed a roll of the herder die, even if we just locked all of our other dice.
     GameState.Message(this.name + " received a Herder die!");
 }
예제 #25
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 //  roll a single die
 public bool RollDie(PharoahDie die)
 {
     if (die == null) return false;
     GameState.GetCurrentGameState().purchaseBoard.SetState(PurchaseBoard.PurchaseBoardState.isTuckedAway);
     UnhideDice();
     DiceCup.StartRolling();
     die.ReadyToRoll();
     die.RollDie();
     return true;
 }
예제 #26
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 public void GiveHerderDie(PharoahDie die)
 {
     bHasExtraHerderDie = true;
     pgs.mayRollDice    = true; //  if we JUST got a herder die, we are always allowed a roll of the herder die, even if we just locked all of our other dice.
     GameState.Message(this.name + " received a Herder die!");
 }
예제 #27
0
 bool isNewDie(PharoahDie die)
 {
     return(!adjustedDice.Contains(die));
 }
예제 #28
0
파일: AddPips.cs 프로젝트: euming/FotP
 bool OnDone(PharoahDie d)
 {
     bool bSuccess = false;
     GameState.Message("Done");
     hasBeenActivatedBySpecificRoll = false; //  deactivate this die ability when done.
     foreach (PharoahDie die in adjustedDice)
     {
         die.FinalizeTempPips();
         bSuccess = true;
     }
     myPlayer.UndoState();   //  go back to previous state
     UIState.EnableCancelButton(false);
     UIState.EnableDoneButton(false);
     this.isUsedThisTurn = true;
     this.isUsedThisRoll = true;
     return bSuccess;
 }
예제 #29
0
 public virtual void OnAcquireDie(PharoahDie die)
 {
     GameState.Message("Tile " + this.name + " triggered OnAcquireDie PharoahDie " + die.name + "\n");
     myDie = die;
 }
예제 #30
0
파일: Reroll.cs 프로젝트: euming/FotP
 //  delegate: when the player chooses a die, this will get called.
 //  user clicked on a die. Which one is it? We have to keep track here for this ability.
 bool PickDie(PharoahDie die)
 {
     return(myPlayer.RollDie(die));
 }
예제 #31
0
 void UndoPips(PharoahDie die)
 {
     die.UndoTempPips();
 }
예제 #32
0
파일: AddPips.cs 프로젝트: euming/FotP
    //  delegate: when the player chooses a die, this will get called.
    //  user clicked on a die. Which one is it? We have to keep track here for this ability.
    bool PickDie(PharoahDie die)
    {
        bool bLegalDie = false;
        bool bIsNewDie = false;

        if (!die.isDieType(onlyFor))
        {
            myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
            GameState.Message("Cannot pick " + die.name + " because it's\nthe wrong type.");
            return false;
        }

        if (isNewDie(die))
        {
            bIsNewDie = true;
        }
        else
        {
            bLegalDie = true;   //  we picked a die that we already have picked
        }

        if (adjustedDice.Count < actualNumDice)  //  can still pick new dice
        {
            if (bIsNewDie)
            {
                die.ClearTempPips();
                adjustedDice.Add(die);          //  add the new die to the list of dice we are modifying
                bLegalDie = true;
            }
        }

        //  if we are a legal die, then we can add pips to it (or undo the addpips)
        if (bLegalDie)
        {
            if (die != curDie)
                lastDie = curDie;
            curDie = die;

            if (isExactlyNumPips)   //  we add exactly this number of pips.
            {
                if (die.getTempPips()==0)   //  we haven't messed with this die yet
                {
                    if (die.GetSide() + nPips > 6)  //  failure case. we can't add this many pips!
                    {
                        adjustedDice.Remove(die);
                        myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
                        GameState.Message("ERROR: Can't add exactly " + nPips.ToString() + " to " + die.name);
                        return false;
                    }
                    else
                    {
                        die.AddTempPips(nPips);
                    }
                }
                else//  we've messed with this die already
                {
                    die.UndoTempPips();
                }
            }
            else//  we can add up to the number of pips specified in nPips to any die
            {
                if (die.getTempPips()+1 > nPips)
                {
                    die.UndoTempPips();
                }
                else
                {
                    if (!setToAnyFace && (die.GetSide() + 1 > 6))  //  failure case. we can't add this many pips!
                    {
                        die.UndoTempPips();
                    }
                    if (!isEntertainer)
                    {
                        if (!isSoothsayer)
                        {
                            //  do the wrap around.
                            if (die.GetSide() + 1 > 6)
                            {
                                //  set the temppips such that it equals 1.
                                die.SetTempPipsValue(1);
                            }
                            else
                            {
                                die.AddTempPips(1);
                            }
                        }
                        else//  Soothsayer nonsense here
                        {
                            int exactlyNumDice = 2;
                            if (isAstrologer)
                                exactlyNumDice = 3;
                            if (adjustedDice.Count!= exactlyNumDice)
                            {
                                GameState.Message("Select exactly " + exactlyNumDice.ToString() + " dice.");
                            }
                            else
                            {
                                PharoahDie otherDie = GetOtherDie(die);
                                if (isAstrologer)
                                    otherDie = lastDie;
                                if ((otherDie.GetSide() > 1) && (die.GetSide() < 6)) //  we can still subtract value from otherDie
                                {
                                    die.AddTempPips(1);
                                    otherDie.AddTempPips(-1);
                                }
                                else if ((die.GetSide() > 1) && (otherDie.GetSide() < 6))//  if we have some value in this die, we can add to the other
                                {
                                    die.AddTempPips(-1);
                                    otherDie.AddTempPips(1);
                                }
                                else//  can't do either, both dice are 1. Make an error
                                {
                                    GameState.Message("Cannot change values.");
                                }
                            }
                        }
                    }
                    else//  entertainer flipping nonsense
                    {
                        int setVal = 7-die.GetSide();
                        if (die.getTempPips() == 0)
                        {
                            die.SetTempPipsValue(setVal);
                        }
                        else
                        {
                            die.UndoTempPips();
                        }
                    }
                }
            }
        }
        else
        {
            GameState.Message("Can't choose " + die.name + " for " + this.name);
        }
        myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
        return bLegalDie;
    }
예제 #33
0
    //  delegate: when the player chooses a die, this will get called.
    //  user clicked on a die. Which one is it? We have to keep track here for this ability.
    bool PickDie(PharoahDie die)
    {
        bool bLegalDie = false;
        bool bIsNewDie = false;

        if (!die.isDieType(onlyFor))
        {
            myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
            GameState.Message("Cannot pick " + die.name + " because it's\nthe wrong type.");
            return(false);
        }

        if (isNewDie(die))
        {
            bIsNewDie = true;
        }
        else
        {
            bLegalDie = true;   //  we picked a die that we already have picked
        }

        if (adjustedDice.Count < actualNumDice)  //  can still pick new dice
        {
            if (bIsNewDie)
            {
                die.ClearTempPips();
                adjustedDice.Add(die);          //  add the new die to the list of dice we are modifying
                bLegalDie = true;
            }
        }

        //  if we are a legal die, then we can add pips to it (or undo the addpips)
        if (bLegalDie)
        {
            if (die != curDie)
            {
                lastDie = curDie;
            }
            curDie = die;

            if (isExactlyNumPips)                  //  we add exactly this number of pips.
            {
                if (die.getTempPips() == 0)        //  we haven't messed with this die yet
                {
                    if (die.GetSide() + nPips > 6) //  failure case. we can't add this many pips!
                    {
                        adjustedDice.Remove(die);
                        myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
                        GameState.Message("ERROR: Can't add exactly " + nPips.ToString() + " to " + die.name);
                        return(false);
                    }
                    else
                    {
                        die.AddTempPips(nPips);
                    }
                }
                else//  we've messed with this die already
                {
                    die.UndoTempPips();
                }
            }
            else//  we can add up to the number of pips specified in nPips to any die
            {
                if (die.getTempPips() + 1 > nPips)
                {
                    die.UndoTempPips();
                }
                else
                {
                    if (!setToAnyFace && (die.GetSide() + 1 > 6))  //  failure case. we can't add this many pips!
                    {
                        die.UndoTempPips();
                    }
                    if (!isEntertainer)
                    {
                        if (!isSoothsayer)
                        {
                            //  do the wrap around.
                            if (die.GetSide() + 1 > 6)
                            {
                                //  set the temppips such that it equals 1.
                                die.SetTempPipsValue(1);
                            }
                            else
                            {
                                die.AddTempPips(1);
                            }
                        }
                        else//  Soothsayer nonsense here
                        {
                            int exactlyNumDice = 2;
                            if (isAstrologer)
                            {
                                exactlyNumDice = 3;
                            }
                            if (adjustedDice.Count != exactlyNumDice)
                            {
                                GameState.Message("Select exactly " + exactlyNumDice.ToString() + " dice.");
                            }
                            else
                            {
                                PharoahDie otherDie = GetOtherDie(die);
                                if (isAstrologer)
                                {
                                    otherDie = lastDie;
                                }
                                if ((otherDie.GetSide() > 1) && (die.GetSide() < 6)) //  we can still subtract value from otherDie
                                {
                                    die.AddTempPips(1);
                                    otherDie.AddTempPips(-1);
                                }
                                else if ((die.GetSide() > 1) && (otherDie.GetSide() < 6))//  if we have some value in this die, we can add to the other
                                {
                                    die.AddTempPips(-1);
                                    otherDie.AddTempPips(1);
                                }
                                else//  can't do either, both dice are 1. Make an error
                                {
                                    GameState.Message("Cannot change values.");
                                }
                            }
                        }
                    }
                    else//  entertainer flipping nonsense
                    {
                        int setVal = 7 - die.GetSide();
                        if (die.getTempPips() == 0)
                        {
                            die.SetTempPipsValue(setVal);
                        }
                        else
                        {
                            die.UndoTempPips();
                        }
                    }
                }
            }
        }
        else
        {
            GameState.Message("Can't choose " + die.name + " for " + this.name);
        }
        myPlayer.AskToChooseDie(this.PickDie, this.GetType().ToString()); //  ask the player to choose a die or dice
        return(bLegalDie);
    }
예제 #34
0
파일: AddPips.cs 프로젝트: euming/FotP
 void UndoPips(PharoahDie die)
 {
     die.UndoTempPips();
 }
예제 #35
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 public void DestroyDie(PharoahDie die)
 {
     die.ReadyToRoll();
     diceList.Remove(die);
     Destroy(die.gameObject);
 }
예제 #36
0
파일: ScarabUI.cs 프로젝트: euming/FotP
    bool SetState(ScarabUIState newState)
    {
        bool bSuccess = false;
        switch (newState)
        {
            default:
            case ScarabUIState.ready:
                selectedDie = null;
                bSuccess = true;
                SetNumScarabsUI();
                break;

            //  try to use the scarab
            case ScarabUIState.scarab_activated:
                //  set aside the scarab for use
                if (GameState.GetCurrentGameState().currentPlayer.UseScarab(type)) {
                    if (SetState(ScarabUIState.waiting_die_select))
                    {
                        bSuccess = true;
                        newState = ScarabUIState.waiting_die_select;
                    }
                }
                break;
            case ScarabUIState.waiting_die_select:
                //GameState.GetCurrentGameState().currentPlayer.AskToChooseDie(this.type.ToString());
                //GameState.Message(this.name + " please select a die for scarab action");
                bSuccess = true;
                break;
        }
        if (bSuccess)
        {
            scuiState = newState;
        }
        return bSuccess;
    }
예제 #37
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 public void SortDiceList()
 {
     PharoahDie.SortList(diceList);
 }
예제 #38
0
파일: TileAbility.cs 프로젝트: euming/FotP
 public virtual void OnAcquireDie(PharoahDie die)
 {
     GameState.Message("Tile " + this.name + " triggered OnAcquireDie PharoahDie " + die.name + "\n");
     myDie = die;
 }
예제 #39
0
    public PlayerTurnStateTriggers onStateTrigger = PlayerTurnStateTriggers.AllTrigger; //  on this state, trigger this ability

    /*
     *  // Use this for initialization
     *  void Start () {
     *
     *  }
     *
     *  // Update is called once per frame
     *  void Update () {
     *
     *  }
     */
    public void SetMyDie(PharoahDie die)
    {
        myDie = die;
    }
예제 #40
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
 public void DestroyDie(PharoahDie die)
 {
     die.ReadyToRoll();
     diceList.Remove(die);
     Destroy (die.gameObject);
 }
예제 #41
0
파일: AddPips.cs 프로젝트: euming/FotP
 bool OnCancel(PharoahDie d)
 {
     bool bSuccess = false;
     this.isUsedThisTurn = false;
     this.isUsedThisRoll = false;
     GameState.Message("Cancel");
     foreach(PharoahDie die in adjustedDice)
     {
         die.UndoTempPips();
         bSuccess = true;
     }
     myPlayer.UndoState();   //  go back to previous state
     UIState.EnableCancelButton(false);
     UIState.EnableDoneButton(false);
     return bSuccess;
 }
예제 #42
0
파일: AddPips.cs 프로젝트: euming/FotP
 public override void OnStartTurn(PlayerBoard plr)
 {
     base.OnStartTurn(plr);
     this.isUsedThisTurn = false;    //  refresh this every turn.
     hasBeenActivatedBySpecificRoll = false;
     curDie = null;
     adjustedDice.Clear();
 }
예제 #43
0
파일: PlayerBoard.cs 프로젝트: euming/FotP
    //  player has chosen a die
    public void ChooseDie(PharoahDie die)
    {
        pgs.UndoState();    //  go back to previous state before WaitingToSelectDie
        bool bSuccessfulDieChosen = pgs.ChooseDie(die); //  calls OnDieSelect delegate. For scarabs, this will reroll or addpip. For TileAbility, it will call the ability's delegate, if any

        if (bSuccessfulDieChosen)
        {
            //  this should be made generic for all TileAbility
            if (this.curScarabInUse && this.curScarabInUse.isConsumed)
            {
                Destroy(this.curScarabInUse.gameObject);    //  destroy the scarab after we've rolled/added pip to the die.
                this.curScarabInUse = null;
            }

            //  This will fire the trigger from the player's point of view. The die chosen should be saved by the delegate in ChooseDie
            if (this.curTileInUse)
            {
                this.curTileInUse.FireTrigger(TileAbility.PlayerTurnStateTriggers.ChooseDie, this);
            }
        }
        else//  we were not able to select a valid die
        {
            if (this.curScarabInUse)
            {
                //  return the scarab back to our list without consuming it
                scarabList.Add(this.curScarabInUse);
                PlayerBoardAllUI.RefreshScarabUI();
                this.curScarabInUse = null;
            }
        }
    }
예제 #44
0
파일: TileAbility.cs 프로젝트: euming/FotP
    /*
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }
    */
    public void SetMyDie(PharoahDie die)
    {
        myDie = die;
    }