Example #1
0
 /////////// implementation details ///////////
 private CharacterBehavior SelectACharacterToOpenRoom(HiddenTileBehaviorIHM tileToDiscover)
 {
     // TODO: choose a character that is neighboor to the room
     foreach (var token in GameObject.FindGameObjectsWithTag("Token"))
     {
         CharacterBehavior character = token.GetComponent <CharacterBehavior>();
         if (character != null && gManager.isActivePlayer(character.affiliationJoueur) && character.isTokenOnBoard())
         {
             return(character);
         }
     }
     Debug.Assert(false, "No valid character found");
     return(null);
 }
Example #2
0
        private void ExecuteActionRoomDiscovered(ActionRoomDiscovered action)
        {
            /*CharacterBehavior chara = GetTokenById(action.tokenId).GetComponent<CharacterBehavior>();
             * CharacterBehaviorIHM charaIHM = chara.GetComponent<CharacterBehaviorIHM>();
             * if (!chara.selected)
             * {
             *  charaIHM.characterSelection();
             * }*/
            HiddenTileBehavior tileBack = GetTileBack(action.tileIndex);

            tileBack.updateAssociatedTile(action.tileName, action.orientation);
            tileToDiscover = tileBack.GetComponent <HiddenTileBehaviorIHM>();
            gManager.onlineGameInterface.ForceEndReplayAction();
        }
Example #3
0
    private void SetTokenPosition(Token token, int row, int column, string carrierName, int carrierOwnerIndex, int indexRoomAssociated)
    {
        if (token.isRemovedFromGame())
        {
            token.GetComponent <TokenIHM>().hideToken();
            // since it is hidden, no need to set a position
            //token.caseActuelle = GameManager.gManager.getCase(row, column);
            //newPosition = token.caseActuelle.transform.position;
        }
        else if (carrierName != null) // carried token
        {
            // do nothing: carried tokens will be placed later
        }
        else if (token.tokenPlace) // token placed on board
        {
            token.caseActuelle = GameManager.gManager.getCase(row, column);
            token.setPosition(token.caseActuelle.transform.position);
        }
        else if (indexRoomAssociated != GameDataItem.NO_REFERENCE) // placed on room
        {
            PlacementTokens cible = findFreePlacementTargetOnHiddenTile(indexRoomAssociated);
            Debug.Assert(cible != null, "No Free Placement Target found on associated tile " + indexRoomAssociated);
            token.cibleToken      = cible;
            cible.tokenAssociated = token.gameObject;
            cible.locked          = true;
            token.setPosition(token.cibleToken.transform.position);

            // Si un joueur vient d'ouvrir une salle et que le pion est en attente d'y etre place
            if (indexRoomAssociated == managerData.roomBeingOpenedIndex)
            {
                token.ciblesTokens.Clear();
                token.ciblesTokens.AddRange(GameObject.FindGameObjectsWithTag("TileRevealedTarget"));
                HiddenTileBehaviorIHM hiddenTile = getHiddenTile(managerData.roomBeingOpenedIndex);
                token.setPosition(hiddenTile.getWaitingToBePlacedTokenPosition(token.cibleToken.transform.position));
            }
        }
        else // not placed
        {
            Debug.Assert(!token.tokenPlace, "there should be nothing to do, since game is in initial state");
        }
    }
Example #4
0
    private void removeTargetOfTokensToBePlacedOnDiscoveredRoom()
    {
        HiddenTileBehaviorIHM hiddenTile = getHiddenTile(managerData.roomBeingOpenedIndex);

        if (hiddenTile != null)
        {
            Transform associatedTile = hiddenTile.transform;
            for (int j = 0; j < associatedTile.childCount; j++)
            {
                if (associatedTile.GetChild(j).name != "Highlight")
                {
                    PlacementTokens cible = associatedTile.GetChild(j).GetComponent <PlacementTokens>();
                    if (cible.tokenAssociated != null)
                    {
                        cible.tokenAssociated.GetComponent <Token>().cibleToken = null;
                        cible.tokenAssociated = null;
                        cible.locked          = false;
                    }
                }
            }
        }
    }