示例#1
0
 public void event_OnTouch(Touche t)
 {
     foreach (State tmp in list)
     {
         if (tmp.OnTouch(t))
         {
             return;
         }
     }
 }
        public override void Load()
        {
            placement     = new List <int>();
            caractere     = new ShuffleList <char>();
            toutestouches = new ShuffleList <char>();
            listeTouche   = new List <Touche>();

            placement.Add(3);
            placement.Add(17);
            placement.Add(21);
            placement.Add(25);

            caractere.Add('P');
            caractere.Add('R');
            caractere.Add('E');
            caractere.Add('S');

            lblPresser = new Label()
            {
                Text = "PRESSER", Location = new Point(315, 60), TextAlign = ContentAlignment.MiddleCenter, Font = new Font("Arial", 22), Width = 160, Height = 45
            };
            Controls.Add(lblPresser);

            // boucle qui va ajouter dans le tableau toutetouches toute les lettre de l'alphabet
            for (char i = 'A'; i <= 'Z'; i++)
            {
                if (i == 'P' | i == 'R' | i == 'E' | i == 'S') // on exclue les touches avec un emplacement reservé
                {
                    continue;
                }
                toutestouches.Add(i);
            }
            toutestouches.Shuffle();
            caractere.Shuffle();

            //Place les lettres avec un emplacement réservé au bon endroit dans la liste toutestouches
            while (placement.Count > 0)
            {
                int iPlace = placement[0];
                placement.RemoveAt(0);

                char clettre = caractere[0];
                caractere.RemoveAt(0);
                toutestouches.Insert(iPlace, clettre);
            }

            for (int i = 0; i <= 25; i++)
            {
                Touche touche = new Touche("" + toutestouches[i], iWidth, iHeight);
                Controls.Add(touche);
                listeTouche.Add(touche);
                touche.BringToFront(); // Fait passer le contrôle au premier rang dans l'ordre de plan.
            }
            PlaceTouche();
        }
示例#3
0
 public override bool OnTouch(Touche t)
 {
     if (!sm.state_is_last(this))
     {
         return(false);
     }
     else
     {
         sm.state_change_son(this, new TouchState(sm, cam, game, t));
         return(true);
     }
 }
示例#4
0
 public override bool OnTouch(Touche t)
 {
     if (!sm.state_is_last(this))
     {
         return false;
     }
     else
     {
         sm.state_change_son(this, new TouchState(sm, cam, game, t));
         return true;
     }
 }
示例#5
0
    // Action de jeu : touche
    public override bool OnTouch(Touche t)
    {
        if (sm.state_has_son(this, typeof(GameActionState)))
        {
            return(false);
        }
        else
        {
            GameActionState newSon = new GameActionState(sm, cam, game);
            sm.state_change_son(this, newSon);
            newSon.OnTouch(t);

            return(true);
        }
    }
示例#6
0
    // Action de jeu : touche
    public override bool OnTouch(Touche t)
    {
        if (sm.state_has_son(this, typeof(GameActionState)))
        {
            return false;
        }
        else
        {
            GameActionState newSon = new GameActionState(sm, cam, game);
            sm.state_change_son(this, newSon);
            newSon.OnTouch(t);

            return true;
        }
    }
示例#7
0
    public override bool OnTouch(Touche t)
    {
        Debug.Log("ConversionFly::OnTouch");

        game.Referee.StopPlayerMovement();
        cam.transalateWithFade(Vector3.zero, Quaternion.identity, 0f, 1f, 1f, 2.5f,
                               (/* OnFinish */) => {
            //please, kill after usage x)
            CameraFade.wannaDie();
            cam.game.Referee.EnablePlayerMovement();
            this.game.OnResumeSignal(game.Referee.FreezeAfterConversion);
        }, (/* OnFade */) => {
            //cam.ChangeCameraState(CameraManager.CameraState.FREE);
            cam.zoom = 1;                     //TODO cam settings
            game.refs.managers.conversion.OnLimit();
            cam.game.Referee.StartPlacement();
        }
                               );
        return(true);
    }
        private int iLocX;                        // Localisation tampon pour calculer l'emplacement des touches en Y

        /// <summary>
        /// Place les 26 touches
        /// </summary>
        public void PlaceTouche()
        {
            iLocX = iLocalisationX;
            iLocY = iLocalisationY;
            for (int i = 0; i <= 25; i++)
            {
                iLocX += iWidth;
                if (i % 7 == 0)
                {
                    // Ces deux commandes nous permettes de faire un "Retour à la ligne" avec les touches
                    iLocX  = iLocalisationX;
                    iLocY += iHeight;
                }
                if (i == 21)
                {
                    iLocX += iWidth;
                }
                Touche touche = listeTouche[i];
                touche.Location = new Point(iLocX, iLocY);
            }
        }
示例#9
0
 public TouchState(StateMachine sm, CameraManager cam, Game game, Touche t)
     : base(sm, cam, game)
 {
     game.Referee.OnTouch(t);
 }
示例#10
0
文件: Game.cs 项目: sylafrs/rugby
 public void OnTouch(Touche t)
 {
     this.refs.stateMachine.event_OnTouch(t);
 }
示例#11
0
 public override bool OnTouch(Touche t)
 {
     game.Referee.StopPlayerMovement();
     cam.transalateWithFade(Vector3.zero, Quaternion.identity, 0f, 1f, 1f,2.5f,
         (/* OnFinish */) => {
             //please, kill after usage x)
             CameraFade.wannaDie();
             cam.game.Referee.EnablePlayerMovement();
             this.game.OnResumeSignal(game.Referee.FreezeAfterConversion);
         }, (/* OnFade */) => {
             //cam.ChangeCameraState(CameraManager.CameraState.FREE);
             cam.zoom = 1; //TODO cam settings
             game.refs.managers.conversion.OnLimit();
             cam.game.Referee.StartPlacement();
         }
     );
     return true;
 }
示例#12
0
 public TouchState(StateMachine sm, CameraManager cam, Game game, Touche t) : base(sm, cam, game)
 {
     game.Referee.OnTouch(t);
 }
示例#13
0
    public void OnTouch(Touche t)
    {
        if (t == null || t.a == null || t.b == null)
        {
            throw new UnityException("I need the touch to be configured");
        }

        // Indique que le jeu passe en mode "Touche"

        // Placement dans la scène de la touche.
        Vector3 pos = Vector3.Project(game.Ball.transform.position - t.a.position, t.b.position - t.a.position) + t.a.position;
        pos.y = 0; // A terre

        if (this.game.refs.placeHolders.touchPlacement == null)
        {
            throw new UnityException("I need to know how place the players when a touch occurs");
        }

        bool right = (pos.x > 0);

        if (right)
        {
            this.game.refs.placeHolders.touchPlacement.localRotation = Quaternion.Euler(0, -90, 0);
        }
        else
        {
            this.game.refs.placeHolders.touchPlacement.localRotation = Quaternion.Euler(0, 90, 0);
        }

        this.game.refs.placeHolders.touchPlacement.position = pos;

        Team interceptTeam = game.Ball.Team;
        Team touchTeam = interceptTeam.opponent;

        // Règlage du mini-jeu
        TouchManager tm = this.game.refs.managers.touch;

        // On indique les équipes
        tm.gamerIntercept = interceptTeam.Player;
        tm.gamerTouch = touchTeam.Player;

        // Fonction à appeller à la fin de la touche
        tm.CallBack = delegate(TouchManager.Result result, int id)
        {
            game.southTeam.OnTouchAction();
            game.northTeam.OnTouchAction();

            Timer.AddTimer(1, () =>
            {
                // On donne la balle à la bonne personne
                if (result == TouchManager.Result.INTERCEPTION)
                {
                    game.Ball.Owner = interceptTeam[id];

                    //super
                    this.IncreaseSuper(game.settings.Global.Super.touchInterceptSuperPoints, interceptTeam);
                    this.IncreaseSuper(game.settings.Global.Super.touchLooseSuperPoints, touchTeam);
                }
                else
                {
                    game.Ball.Owner = touchTeam[id + 1];
                    interceptTeam.Player.ChangeControlled(interceptTeam[id]);

                    //super
                    this.IncreaseSuper(game.settings.Global.Super.touchWinSuperPoints, touchTeam);
                }

                game.OnResumeSignal(freezeAfterTouch);
            });
        };

        tm.enabled = true;
    }
示例#14
0
文件: Events.cs 项目: sylafrs/rugby
 public void event_OnTouch(Touche t)
 {
     foreach (State tmp in list)
     {
         if (tmp.OnTouch(t))
             return;
     }
 }
示例#15
0
文件: Events.cs 项目: sylafrs/rugby
 public virtual bool OnTouch(Touche t)
 {
     return (false);
 }
示例#16
0
    public void OnTouch(Touche t)
    {
        if (t == null || t.a == null || t.b == null)
        {
            throw new UnityException("I need the touch to be configured");
        }

        // Indique que le jeu passe en mode "Touche"

        // Placement dans la scène de la touche.
        Vector3 pos = Vector3.Project(game.Ball.transform.position - t.a.position, t.b.position - t.a.position) + t.a.position;

        pos.y = 0; // A terre

        if (this.game.refs.placeHolders.touchPlacement == null)
        {
            throw new UnityException("I need to know how place the players when a touch occurs");
        }

        bool right = (pos.x > 0);

        if (right)
        {
            this.game.refs.placeHolders.touchPlacement.localRotation = Quaternion.Euler(0, -90, 0);
        }
        else
        {
            this.game.refs.placeHolders.touchPlacement.localRotation = Quaternion.Euler(0, 90, 0);
        }

        this.game.refs.placeHolders.touchPlacement.position = pos;

        Team interceptTeam = game.Ball.Team;
        Team touchTeam     = interceptTeam.opponent;

        // Règlage du mini-jeu
        TouchManager tm = this.game.refs.managers.touch;

        // On indique les équipes
        tm.gamerIntercept = interceptTeam.Player;
        tm.gamerTouch     = touchTeam.Player;

        // Fonction à appeller à la fin de la touche
        tm.CallBack = delegate(TouchManager.Result result, int id)
        {
            game.southTeam.OnTouchAction();
            game.northTeam.OnTouchAction();

            Timer.AddTimer(1, () =>
            {
                // On donne la balle à la bonne personne
                if (result == TouchManager.Result.INTERCEPTION)
                {
                    game.Ball.Owner = interceptTeam[id];

                    //super
                    this.IncreaseSuper(game.settings.Global.Super.touchInterceptSuperPoints, interceptTeam);
                    this.IncreaseSuper(game.settings.Global.Super.touchLooseSuperPoints, touchTeam);
                }
                else
                {
                    game.Ball.Owner = touchTeam[id + 1];
                    interceptTeam.Player.ChangeControlled(interceptTeam[id]);

                    //super
                    this.IncreaseSuper(game.settings.Global.Super.touchWinSuperPoints, touchTeam);
                }

                game.OnResumeSignal(freezeAfterTouch);
            });
        };

        tm.enabled = true;
    }
示例#17
0
 public void OnTouch(Touche t)
 {
     this.refs.stateMachine.event_OnTouch(t);
 }
示例#18
0
 public virtual bool OnTouch(Touche t)
 {
     return(false);
 }