Beispiel #1
0
    public void myUpdate()
    {
        if (XboxController == null)
        {
            XboxController = game.refs.xboxInputs.controllers[id];
        }

        if (Inputs == null)
        {
            return;
        }

        if (Controlled)
        {
            UpdateDODGE();

            if (!Controlled.Dodge && !Controlled.isTackled)
            {
                UpdateStickDirection();
                //UpdateSUPER();
                UpdateMOVE();
                UpdateTACKLE();
                UpdateDROP();
                if (!UpdateESSAI())
                {
                    UpdatePASS();
                }
            }
        }

        UpdatePLAYER();
    }
Beispiel #2
0
    public Gamer(Team t)
    {
        this.game = t.game;

        canMove = true;

        id = NextGamerId;
        NextGamerId++;
        playerIndex = (PlayerIndex)id;

        game.refs.xboxInputs.NeedToCheck(id);

        if (XboxController == null)
            XboxController = this.game.refs.xboxInputs.controllers[id];

        this.Team = t;
        this.Controlled = t[t.nbUnits / 2];
        this.Controlled.IndicateSelected(true);
        this.Inputs = this.game.settings.Inputs;
    }
Beispiel #3
0
    public Gamer(Team t)
    {
        this.game = t.game;

        canMove = true;

        id = NextGamerId;
        NextGamerId++;
        playerIndex = (PlayerIndex)id;

        game.refs.xboxInputs.NeedToCheck(id);

        if (XboxController == null)
        {
            XboxController = this.game.refs.xboxInputs.controllers[id];
        }

        this.Team       = t;
        this.Controlled = t[t.nbUnits / 2];
        this.Controlled.IndicateSelected(true);
        this.Inputs = this.game.settings.Inputs;
    }
Beispiel #4
0
    void Update()
    {
        p1.newFrame();
        p2.newFrame();

#if UNITY_EDITOR
        if (p1.XboxController.GetButtonDown(XBOX_BUTTONS.Start) || p2.XboxController.GetButtonDown(XBOX_BUTTONS.Start))
        {
            UnityEditor.EditorApplication.isPaused = true;
        }
        if (p1.XboxController.GetButtonDown(XBOX_BUTTONS.RightStick) || p2.XboxController.GetButtonDown(XBOX_BUTTONS.RightStick))
        {
            XboxInputs.Controller c = p1.XboxController;
            p1.XboxController = p2.XboxController;
            p2.XboxController = c;
        }
#endif

        if (fillBars)
        {
            this.southTeam.SuperGaugeValue = 200;
            this.northTeam.SuperGaugeValue = 200;
        }
    }
Beispiel #5
0
    public void myUpdate()
    {
        if (XboxController == null)
            XboxController = game.refs.xboxInputs.controllers[id];

        if (Inputs == null)
            return;

        if (Controlled)
        {
            UpdateDODGE();

            if (!Controlled.Dodge && !Controlled.isTackled)
            {
                UpdateStickDirection();
                //UpdateSUPER();
                UpdateMOVE();
                UpdateTACKLE();
                UpdateDROP();
                if (!UpdateESSAI())
                {
                    UpdatePASS();
                }
            }
        }

        UpdatePLAYER();
    }
Beispiel #6
0
    private float GetSmashResult(out bool used)
    {
        float smash = 0;

        used = false;

        InputSettings inputs = game.settings.Inputs;

        XboxInputs.Controller southCtrl = game.southTeam.Player.XboxController;
        XboxInputs.Controller northCtrl = game.northTeam.Player.XboxController;

        bool smashSouth = southCtrl.GetButtonDown(inputs.smashButton.xbox) || Input.GetKeyDown(inputs.smashButton.keyboard(game.southTeam));
        bool smashNorth = northCtrl.GetButtonDown(inputs.smashButton.xbox) || Input.GetKeyDown(inputs.smashButton.keyboard(game.northTeam));

        bool superSouth = southCtrl.GetButtonDown(inputs.superButton.xbox) || Input.GetKeyDown(inputs.superButton.keyboard(game.southTeam));
        bool superNorth = northCtrl.GetButtonDown(inputs.superButton.xbox) || Input.GetKeyDown(inputs.superButton.keyboard(game.northTeam));

        if (smashSouth)
        {
            smash            += this.settings.SmashValue;
            this.SuperLoading = Mathf.Min(1, this.SuperLoading + this.settings.FeedSuperPerSmash);
            this.ScrumBloc.FeedBackSmash(game.southTeam);
        }

        if (smashNorth)
        {
            smash            -= this.settings.SmashValue;
            this.SuperLoading = Mathf.Min(1, this.SuperLoading + this.settings.FeedSuperPerSmash);
            this.ScrumBloc.FeedBackSmash(game.northTeam);
        }

        if (this.SuperLoading == 1)
        {
            int super = 0;

            if (superSouth)
            {
                super += 1;
                used   = true;
            }

            if (superNorth)
            {
                super -= 1;
                used   = true;
            }

            if (used)
            {
                this.InvincibleTime = settings.InvincibleCooldown;
                this.SuperLoading   = 0;
                smash += super * this.settings.SuperMultiplicator * this.settings.SmashValue;

                var audio = this.game.refs.CameraAudio["SuperScrum"];
                audio.volume = 1;
                audio.PlayOneShot(game.refs.sounds.SuperScrum);

                audio        = this.game.refs.CameraAudio["SuperScrumSuccess"];
                audio.volume = 1;
                audio.PlayOneShot(game.refs.sounds.SuperScrumSuccess);

                if (super != 0)
                {
                    Team t = game.southTeam;
                    if (super != 1)
                    {
                        t = game.northTeam;
                    }

                    game.refs.gameObjects.ScrumBloc.PushFor(t);
                }
            }
        }
        else
        {
            if (InvincibleTime > 0)
            {
                InvincibleTime -= Time.deltaTime;
            }
            else
            {
                bool fail = false;

                if (superSouth)
                {
                    this.MalusSouth = Time.time;
                    smash          -= this.settings.SmashValue * this.settings.MalusValue;
                    southCtrl.SetLeftVibration(0.8f, 0.4f);
                    fail = true;
                }

                if (superNorth)
                {
                    this.MalusNorth = Time.time;
                    smash          += this.settings.SmashValue * this.settings.MalusValue;
                    northCtrl.SetLeftVibration(0.8f, 0.4f);
                    fail = true;
                }

                if (fail)
                {
                    var audio = this.game.refs.CameraAudio["SuperScrum"];
                    audio.volume = 1;
                    audio.PlayOneShot(game.refs.sounds.SuperScrum);

                    audio        = this.game.refs.CameraAudio["SuperScrumFail"];
                    audio.volume = 1;
                    audio.PlayOneShot(game.refs.sounds.SuperScrumFail);
                }
            }
        }

        return(smash);
    }