Esempio n. 1
0
 public override void OnInputUp()
 {
     base.OnInputUp();
     if (gManager.gameMacroState == GameProgression.Playing)
     {
         if (Time.time - doubleTouchTimer < DOUBLE_CLICK_MAX_INTERVAL)
         {
             // Combat si click sur un ennemi atteignable
             if (!associatedCharacter.isRemovedFromGame() && associatedCharacter.caseActuelle.GetComponent <CaseBehavior>().cibleAssociated.GetComponent <CibleDeplacementIHM>().adjacentFighter&&
                 gManager.actionCharacter.GetComponent <Token>().affiliationJoueur != associatedCharacter.affiliationJoueur &&
                 !gManager.usingSpecialAbility)
             {
                 gManager.combatManager.combat(gameObject);
             }
         }
         else
         {
             if (Time.time - selectionTimer < SIMPLE_CLICK_DURATION)
             {
                 if (!alreadySelected)
                 {
                     // Encore utilisée ?
                     if (moveTargets.Count > 0)
                     {
                         if (associatedCharacter.canStayOnCell(moveTargets[moveTargets.Count - 1].GetComponent <CibleDeplacement>().caseAssociated.GetComponent <CaseBehavior>()))
                         {
                             GameObject target = moveTargets[moveTargets.Count - 1];
                             target.GetComponent <CibleDeplacement>().nbDeplacementRestant = 0;
                             associatedCharacter.deplacementConfirmed(target);
                             endDeplacementIHM();
                         }
                     }
                     else
                     {
                         characterSelection();
                     }
                 }
                 doubleTouchTimer = Time.time;
             }
             // Dans le cas d'un appui long
             else if (moveTargets.Count > 0)
             {
                 pickUpOverflownToken();
                 recomputePossibleActionsIHM(true, true);
             }
         }
         alreadySelected = false;
     }
 }
Esempio n. 2
0
    // Vérifie l'ensemble des actions spéciales qui peuvent etre exécutées depuis la case actuelle vers la direction ciblée
    public void checkAdjacentCell(CaseBehavior currentCell, int dir)
    {
        if (!currentCell.debordement(dir))
        {
            CaseBehavior nextCell = currentCell.getCaseVers(dir);

            if (!nextCell.isCaseRevealed())
            {
                // Si une salle non ouverte est adjacente et accessible, en permettre l'ouverture
                if (currentCell.cheminDegage(currentCell.versDirection(dir)))
                {
                    RegisterAction(ActionType.REVEAL, nextCell, 0);
                }
            }
            else
            {
                // Accès à la case pour vérifier que l'on peut s'y déplacer
                if (currentCell.cheminDegage(currentCell.versDirection(dir)) && nextCell.cheminDegage(nextCell.versDirection(CaseBehavior.opposee(dir))))
                {
                    // Regarder si un combat est possible
                    if (nextCell.enemyFighterPresent(currentCharacter.gameObject))
                    {
                        RegisterAction(ActionType.ATTACK, nextCell, 0);
                    }

                    if (currentCharacter is CB_Clerc)
                    {
                        // Regarder si un allie peut etre soigne
                        if (nextCell.woundedCharacterReadyForHealing())
                        {
                            RegisterAction(ActionType.HEAL, nextCell, 0);
                        }
                    }
                }

                // Si une herse non brisee relie cette case
                if (nextCell.herse != null && currentCell.herse == nextCell.herse && !nextCell.herse.GetComponent <HerseBehavior>().herseBrisee)
                {
                    if (currentCharacter is CB_Guerrier)
                    {
                        RegisterAction(ActionType.DESTROYDOOR, nextCell, 0);
                    }
                    else if (currentCharacter is CB_Voleuse)
                    {
                        if (currentCell.herse.GetComponent <HerseBehavior>().herseOuverte)
                        {
                            RegisterAction(ActionType.CLOSEDOOR, nextCell, 0);
                        }
                        else
                        {
                            RegisterAction(ActionType.OPENDOOR, nextCell, 0);
                        }
                    }
                }
            }
        }

        if (currentCharacter is CB_PasseMuraille)
        {
            if (!currentCell.debordement(dir))
            {
                // Peut franchir les murs adjacents
                CaseBehavior nextCell = currentCell.getCaseVers(dir);
                if (nextCell.isCaseRevealed())
                {
                    if (currentCell.versDirection(dir) == CaseBehavior.cheminCaseAdjacente.mur ||
                        nextCell.versDirection(CaseBehavior.opposee(dir)) == CaseBehavior.cheminCaseAdjacente.mur
                        )
                    {
                        if (currentCharacter.canStayOnCell(nextCell))
                        {
                            RegisterAction(ActionType.WALLWALK, currentCell, 0);
                            RegisterAction(ActionType.WALLWALK, nextCell, 1, currentCell);
                        }
                    }
                }
            }
        }
    }