示例#1
0
    // ************* //
    // ** Actions ** //
    // ************* //

    void changeColorEnter()
    { // Change la couleur de la case qui est sur le curseur
        Player      currentPlayer      = GameManager.Instance.currentPlayer;
        Phase       currentPhase       = GameManager.Instance.currentPhase;
        Color       actionColor        = ColorManager.Instance.actionColor;
        Color       moveColor          = ColorManager.Instance.moveColor;
        PersoData   selectedPersonnage = SelectionManager.Instance.selectedPersonnage;
        Color       hoverColor         = ColorManager.Instance.hoverColor;
        PersoAction actualAction       = GameManager.Instance.actualAction;

        switch (currentPhase)
        {
        case (Phase.Placement):
            hoveredCase.GetComponent <CaseData>().ChangeColor(Statut.isHovered);
            break;

        case (Phase.Deplacement):
            if (SelectionManager.Instance.selectedPersonnage != null)
            {
                MoveBehaviour.Instance.HidePath();
                if (hoveredPersonnage != null &&
                    hoveredPersonnage.GetComponent <PersoData>().owner != currentPlayer &&
                    Fonction.Instance.CheckAdjacent(selectedPersonnage.gameObject, hoveredPersonnage.gameObject) == true)
                {
                    //          hoveredCase.GetComponent<CaseData>().ChangeColor(actionColor);
                }

                if (hoveredPersonnage != null &&
                    hoveredPersonnage.GetComponent <PersoData>().owner == currentPlayer)
                {
                    //     hoveredCase.GetComponent<CaseData>().ChangeColor(actionColor);
                }

                if (hoveredBallon != null &&
                    Fonction.Instance.CheckAdjacent(selectedPersonnage.gameObject, hoveredBallon.gameObject) == true)
                {
                    //   hoveredCase.GetComponent<CaseData>().ChangeColor(actionColor);
                }

                if (hoveredCase.GetComponent <CaseData>().casePathfinding == PathfindingCase.Walkable &&
                    actualAction == PersoAction.isSelected)
                {
                    MoveBehaviour.Instance.createPath();

                    if (hoveredLastCase != hoveredCase)
                    {
                        Pathfinding.Instance.StartPathfinding();
                    }
                }
            }
            break;
        }
    }
示例#2
0
    IEnumerator LateOnNewClick()
    {
        yield return(new WaitForEndOfFrame());

        CaseData        hoveredCase     = HoverManager.Instance.hoveredCase;
        PersoAction     actualAction    = GameManager.Instance.actualAction;
        PathfindingCase casePathfinding = hoveredCase.GetComponent <CaseData>().casePathfinding;

        if (pathes.Count != 0 &&
            actualAction == PersoAction.isSelected &&
            pathes.Contains(hoveredCase.transform))
        {
            SendDeplacement();
        }
    }
示例#3
0
    public void OnNewClick()
    { // Lors d'un click sur une case
        Phase       currentPhase       = TurnManager.Instance.currentPhase;
        BallonData  hoveredBallon      = HoverManager.Instance.hoveredBallon;
        PersoData   selectedPersonnage = SelectionManager.Instance.selectedPersonnage;
        PersoAction actualAction       = GameManager.Instance.actualAction;

        if (currentPhase == Phase.Deplacement &&
            selectedPersonnage != null &&
            hoveredBallon != null &&
            actualAction == PersoAction.isSelected)
        {
            if (Fonction.Instance.CheckAdjacent(hoveredBallon.gameObject, selectedPersonnage.gameObject) == true)
            {
                ShotMenu();
            }
        }
    }
示例#4
0
    void CheckIfAction()
    {     // Action de replacer la balle qui se termine après avoir placer la balle
        PersoAction actualAction = GameManager.Instance.actualAction;

        if (actualAction == PersoAction.isReplacingBall)
        {
            List <CaseData> caseAction  = ReplacerBalleBehaviour.Instance.caseAction;
            Color           actionColor = ColorManager.Instance.actionColor;

            foreach (CaseData obj in caseAction)
            {
                if (obj == hoveredCase)
                {
                    //    hoveredCase.GetComponent<CaseData>().ChangeColor(actionColor);
                }
            }
        }
    }
示例#5
0
    public void OnNewClick()
    {
        PersoData   hoveredPersonnage  = HoverManager.Instance.hoveredPersonnage;
        Phase       currentPhase       = TurnManager.Instance.currentPhase;
        Player      currentPlayer      = TurnManager.Instance.currentPlayer;
        PersoAction actualAction       = GameManager.Instance.actualAction;
        PersoData   selectedPersonnage = SelectionManager.Instance.selectedPersonnage;

        if (actualAction == PersoAction.isSelected &&
            currentPhase == Phase.Deplacement &&
            selectedPersonnage != null &&
            hoveredPersonnage != null &&
            hoveredPersonnage.GetComponent <PersoData>().owner != currentPlayer &&
            selectedPersonnage.GetComponent <PersoData>().pointAction != 0 &&
            Fonction.Instance.CheckAdjacent(selectedPersonnage.gameObject, hoveredPersonnage.gameObject) == true)
        {
            Punch(HoverManager.Instance.hoveredPersonnage);
        }
    }
示例#6
0
    public void TirReplacerBalle()
    {
        PersoData   selectedPersonnage = SelectionManager.Instance.selectedPersonnage;
        CaseData    hoveredCase        = HoverManager.Instance.hoveredCase;
        PersoAction actualAction       = GameManager.Instance.actualAction;
        BallonData  selectedBallon     = SelectionManager.Instance.selectedBallon;

        if (actualAction == PersoAction.isReplacingBall &&
            caseAction.Count != 0)
        {
            if (caseAction.Contains(hoveredCase))
            {
                selectedBallon.transform.position = hoveredCase.transform.position;
                hoveredCase.GetComponent <CaseData>().ChangeColor(Statut.canReplace);
                StartCoroutine(ReplacerBalleEnd());
                return;
            }
            StartCoroutine(ReplacerBalleEnd());
            selectedPersonnage.GetComponent <PersoData> ().actualPointMovement++;
        }
    }
示例#7
0
    public void SelectPerso(CaseData hoveredCase, PersoData hoveredPersonnage, Color selectedColor, Phase currentPhase, Player currentPlayer, PersoAction actualAction)
    {
        Deselect(currentPhase, currentPlayer);
        selectedCase       = hoveredCase;
        selectedPersonnage = hoveredPersonnage;

        selectedCase.caseColor = selectedColor;
        selectedCase.ChangeColor(Statut.isSelected);
        GameManager.Instance.actualAction = PersoAction.isSelected;
        CaseManager.Instance.StartCoroutine("ShowActions");
    }
示例#8
0
    // *************** //
    // ** Initialisation ** //
    // *************** //

    void Awake()
    {
        Instance     = this;
        actualAction = PersoAction.isIdle;
    }