Ejemplo n.º 1
0
        public Game()
        {
            this.deviceSet = new VeldridDeviceSet();

            // FIXME: How the generics was done is bad, lets fix that.
            var defaultSet = (IDeviceSet)deviceSet;

            this.DeviceSetControl = new DeviceSetControl(defaultSet);

            // Create a input system and register a few inputs.
            this.InputSystem = new InputSystem(
                defaultSet.Keyboard,
                defaultSet.Mouse);

            var layout = MyLayout.DefaultLayout;

            layout.Apply(InputSystem);

            // Create a combo tracker and register a few combos.
            this.ComboTracker = new ComboTracker(
                defaultSet.KeyboardTracker);

            this.ComboTracker.SequenceCombos.Add("Attack1", Keys.A, Keys.B, Keys.C);
            this.ComboTracker.SequenceCombos.Add("Attack2", Keys.A, Keys.C, Keys.B);
            this.ComboTracker.SequenceCombos.Add("Attack3", Buttons.A, Buttons.B, Buttons.X);
            this.ComboTracker.SequenceCombos.Add("Attack4", Keys.A, Keys.X, Keys.X);

            this.ComboTrackerControl = new ComboTrackerControl(this.ComboTracker);
            this.InputSystemControl  = new InputSystemControl(this.InputSystem);
        }
Ejemplo n.º 2
0
    //NOTE REACHED END-POSITION CHECK
    void InterpolationEndCheck()
    {
        //Check for when the note's position is at the coordinates (0, 0)
        if (transform.position == new Vector3(0, 0, 0) && !reachedEndPos)
        {
            //Calls the Damage method to decrease the player's health on a miss
            HealthSys.Damage();

            //Calls the ResetComboCount method to reset the player's current combo on a miss
            ComboTracker.ResetComboCount();

            //Play note miss sound
            if (HealthSys.health > 0)
            {
                AudioManager.instance.Play("NoteMiss");
            }

            //Call any methods that are currently subscribed to the _noteReachedDestination event
            if (_noteReachedDestination != null)
            {
                _noteReachedDestination();
            }

            nfo.StartCoroutine("FadeAndDestroy");

            reachedEndPos = true;
        }
    }
Ejemplo n.º 3
0
        private void TestWindow_ComboTracker(ComboTracker comboTracker, IList <string> comboHistory)
        {
            ImGui.BeginWindow("ComboTracker");
            {
                ImGui.Text("# Combos:");
                foreach (var item in comboTracker.SequenceCombos)
                {
                    ImGui.Text($"{ item.Name } = [{ string.Join(", ", item.Keys) }]");
                }

                ImGui.Separator();
                ImGui.Text($"Current: { comboTracker.GetHistoryString() }");

                ImGui.Separator();
                ImGui.Text("# History:");

                ImGui.BeginChild("ComboTrackerChild1", true);
                {
                    foreach (var item in comboHistory)
                    {
                        ImGui.Text(item);
                    }
                }
                ImGui.EndChild();
            }
            ImGui.EndWindow();
        }
Ejemplo n.º 4
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        m_Camera       = Camera.main.transform;
        m_Controller   = GetComponent <CharController>();
        m_Renderer     = transform.Find("Renderer").GetComponent <SpriteRenderer>();
        m_Animator     = m_Renderer.gameObject.GetComponent <Animator>();
        m_Tile         = GetComponentInChildren <Tile>();
        m_CameraTarget = transform.Find("CameraTarget");
        m_HurtBoxR     = transform.Find("HurtBoxR").GetComponent <HurtBox>();
        m_HurtBoxL     = transform.Find("HurtBoxL").GetComponent <HurtBox>();

        m_ComboTracker = new ComboTracker();
        //m_ComboTracker.debug = true;
        m_ComboTracker.RegisterCombo("L H L", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.AttackH, CombatInput.AttackL
        });
        m_ComboTracker.RegisterCombo("L L H", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.AttackL, CombatInput.AttackH
        });
        //m_ComboTracker.RegisterCombo("Launcher",	new CombatInput[3] { CombatInput.Down,		CombatInput.Up,			CombatInput.AttackH });
        m_ComboTracker.RegisterCombo("Launcher", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.Up, CombatInput.AttackH
        });
        m_ComboTracker.RegisterCombo("Slammer", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.Down, CombatInput.AttackH
        });
        //m_ComboTracker.RegisterCombo("Pusher R",	new CombatInput[3] { CombatInput.Left,		CombatInput.Right,		CombatInput.AttackH });
        //m_ComboTracker.RegisterCombo("Pusher L",	new CombatInput[3] { CombatInput.Right,		CombatInput.Left,		CombatInput.AttackH });
        m_ComboTracker.RegisterCombo("Booster R", new CombatInput[3] {
            CombatInput.Right, CombatInput.Right, CombatInput.AttackL
        });
        m_ComboTracker.RegisterCombo("Booster L", new CombatInput[3] {
            CombatInput.Left, CombatInput.Left, CombatInput.AttackL
        });
        m_ComboTracker.RegisterCombo("Booster D", new CombatInput[3] {
            CombatInput.Down, CombatInput.Down, CombatInput.AttackL
        });
        m_ComboTracker.RegisterCombo("Pusher R", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.Right, CombatInput.AttackH
        });
        m_ComboTracker.RegisterCombo("Pusher L", new CombatInput[3] {
            CombatInput.AttackL, CombatInput.Left, CombatInput.AttackH
        });
        m_ComboTracker.OnComboFinished += ComboTracker_OnComboFinished;

        m_HurtBoxR.OnHurt += HurtBoxR_OnHurt;
        m_HurtBoxL.OnHurt += HurtBoxL_OnHurt;

        m_Controller.OnAirborne += OnAirborne;
        m_Controller.OnAttackH  += OnAttackH;
        m_Controller.OnAttackL  += OnAttackL;
        m_Controller.OnDodge    += OnDodge;
        m_Controller.OnGrounded += OnGrounded;
        m_Controller.OnJump     += OnJump;
        m_Controller.OnJump     += OnAirJump;
        m_Controller.OnSault    += OnSault;
    }
Ejemplo n.º 5
0
    public static event NoteHit _noteHit;     //Event to be invoked when a note gets hit

    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKeyDown(pressedKey1) | Input.GetKeyDown(pressedKey2)) && !PauseMenu.gameIsPaused)
        {
            if (canBePressed)
            {
                ComboTracker.AddToComboCount();

                //Call any methods that are currently subscribed to the _noteReachedDestination event
                if (_noteHit != null)
                {
                    _noteHit();
                }

                gameObject.SetActive(false);
                AudioManager.instance.PlayOneShot("NoteHit");
            }
        }
    }
Ejemplo n.º 6
0
        public TestContext(DeviceSet defaultSet)
        {
            //new Mallos.Input.RawDeviceSet(windowHandle.Value), // TODO: Window Handle

            // Add the different types of input context.
            DeviceSets = new List <DeviceSet>(new[]
            {
                defaultSet,
                new Mallos.Input.Dummy.DummyDeviceSet(),
            });

            // Create a input system and register a few inputs.
            InputSystem = new InputSystem(defaultSet.Keyboard, defaultSet.Mouse);
            InputSystem.Actions.Add(new InputAction("Jump", Keys.Space));
            InputSystem.Axis.Add(new InputAxis("MoveForward", Keys.W, 1.0f));
            InputSystem.Axis.Add(new InputAxis("MoveForward", Keys.S, -1.0f));

            // Create a combo tracker and register a few combos.
            ComboTracker = new ComboTracker(defaultSet.KeyboardTracker, 0.5f, 4);
            ComboTracker.OnComboCalled += ComboTracker_OnComboCalled;
            ComboTracker.SequenceCombos.Add(new SequenceCombo("Attack1", Keys.A, Keys.B, Keys.C));
            ComboTracker.SequenceCombos.Add(new SequenceCombo("Attack2", Keys.A, Keys.C, Keys.B));
            ComboTracker.SequenceCombos.Add(new SequenceCombo("Attack3", Buttons.A, Buttons.B, Buttons.X));
        }
Ejemplo n.º 7
0
    /// <summary>
    /// Initialize the agent
    /// </summary>
    public override void InitializeAgent()
    {
        base.InitializeAgent();
        stats        = new BoxerStats();
        health       = GetComponent <Health>();
        comboTracker = GetComponent <ComboTracker>();
        bufferSize   = 0;

        dodgeAction = new Action(dodgeDuration, dodgeCooldown, dodgeEventDelay);
        if (isTeacher)
        {
            dodgeAction = new Action(dodgeCooldown);
        }
        dodgeAction.animationStart.AddListener(RegisterDodge);
        dodgeAction.animationEnd.AddListener(DeregisterDodge);

        punchAction = new Action(punchDuration, punchCooldown, punchEventDelay);
        punchAction.animationStart.AddListener(RegisterPunch);
        punchAction.animationEnd.AddListener(DeregisterPunch);

        hitEvent = new UnityEvent();

        currentAction = MLAction.NOTHING;
    }
Ejemplo n.º 8
0
 public ComboTrackerControl(ComboTracker comboTracker)
 {
     this.ComboTracker = comboTracker;
     this.ComboTracker.OnComboCalled += this.ComboTracker_OnComboCalled;
     this.ComboTracker.OnComboReset  += this.ComboTracker_OnComboReset;
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     current = this;
 }