コード例 #1
0
ファイル: Receiver.cs プロジェクト: Reaxt/RhythmThing
 public Receiver(Chart.collumn col, List <Chart.NoteInfo> noteInfos, Chart chart)
 {
     this.chart   = chart;
     collumn      = col;
     notes        = new List <Chart.NoteInfo>(noteInfos);
     spawnedNotes = new List <Chart.NoteInfo>();
     deadNotes    = new List <Arrow>();
     arrows       = new List <Arrow>();
     //dictionary representing mods
     this.mods = ModEffects.getNewModsDictionary();
 }
コード例 #2
0
ファイル: Arrow.cs プロジェクト: Reaxt/RhythmThing
        public override void Update(double time, Game game)
        {
            rotation++;
            if (rotation > 360)
            {
                rotation = 1;
            }
            visual.rotation = rotation;

            /*
             * float percent = (chart.beat - beatTime) / (noteInfo.time - beatTime);
             * if(percent >= 0.5)
             * {
             *
             *          visual.y = aimY + (int)Math.Round(percent * movementAmount);
             *
             *
             * }
             * actualY = visual.y;
             * visual.x = actualX + xOffset;
             * visual.y = actualY + yOffset; */

            float percent = noteInfo.time - chart.beat;

            //set x and ymodoffset
            xModOffset = ModEffects.CalculateArrowX(mods, percent);
            yModOffset = ModEffects.CalculateArrowY(mods, percent);



            actualY = (int)(aimY - Math.Cos(angle * 2 * Math.PI) * (Math.Round((percent / chart.firstBPM) * 60 * movementAmount)));
            //angle calculation done by Nytlaz because I Can Not Math
            visual.x = actualX + xOffset - (int)(Math.Sin(angle * 2 * Math.PI) * (Math.Round((percent / chart.firstBPM) * 60 * movementAmount))) + xModOffset;
            visual.y = actualY + yOffset + yModOffset;
            //say fuckyou to all the above stuff if we need to.
            if (frozen)
            {
                visual.x = frozenX;
                visual.y = frozenY;
            }
            //make sure frozen only works if this loops been ran once
            wealive = true;
        }
コード例 #3
0
ファイル: Receiver.cs プロジェクト: Reaxt/RhythmThing
        public override void Update(double time, Game game)
        {
            xModOffset = 0;
            yModOffset = 0;
            //how to do mods!
            xModOffset = ModEffects.CalculateReceiverX(mods);
            yModOffset = ModEffects.CalculateReceiverY(mods);



            visual.x        = xOffset + actualX + xModOffset;
            visual.y        = yOffset + actualY + yModOffset;
            pressedVisual.x = visual.x;
            pressedVisual.y = visual.y;
            nMiss           = false;
            foreach (var note in notes)
            {
                if (chart.beat >= note.time - chart.approachBeat)
                {
                    //Console.WriteLine(collumn);
                    //spawn the note
                    Arrow temparrow = new Arrow(collumn, note, this.chart);
                    game.addGameObject(temparrow);
                    arrows.Add(temparrow);
                    temparrow.mods = this.mods;
                    spawnedNotes.Add(note);
                }
            }
            foreach (var note in spawnedNotes)
            {
                notes.Remove(note);
            }
            spawnedNotes.Clear();
            //more to come
            //here it come
            foreach (var item in arrows)
            {
                item.xOffset = this.xOffset;
                item.yOffset = this.yOffset;
                item.dir     = this.direction;
                item.angle   = this.rot;
                if (chart.beat >= (item.noteInfo.time - chart.scoreTime) && chart.beat <= (item.noteInfo.time + chart.scoreTime))
                {
                    //time to HITE
                    //have to write this after
                    //Console.WriteLine("HIT");
                    bool hit = false;
                    switch (collumn)
                    {
                    case Chart.collumn.Left:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Left] == Input.ButtonState.Press)
                        {
                            hit = true;
                        }

                        break;

                    case Chart.collumn.Down:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Down] == Input.ButtonState.Press)
                        {
                            hit = true;
                        }
                        break;

                    case Chart.collumn.Up:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Up] == Input.ButtonState.Press)
                        {
                            hit = true;
                        }
                        break;

                    case Chart.collumn.Right:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Right] == Input.ButtonState.Press)
                        {
                            hit = true;
                        }
                        break;

                    default:
                        hit = false;
                        break;
                    }
                    if (hit)
                    {
                        nMiss = true;
                        chart.scoreHandler.Hit();
                        deadNotes.Add(item);
                    }
                }
                else if (chart.beat <= (item.noteInfo.time + chart.missTime) && (item.noteInfo.time - chart.missTime) <= chart.beat)
                {
                    bool miss = false;
                    switch (collumn)
                    {
                    case Chart.collumn.Left:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Left] == Input.ButtonState.Press)
                        {
                            miss = true;
                        }

                        break;

                    case Chart.collumn.Down:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Down] == Input.ButtonState.Press)
                        {
                            miss = true;
                        }
                        break;

                    case Chart.collumn.Up:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Up] == Input.ButtonState.Press)
                        {
                            miss = true;
                        }
                        break;

                    case Chart.collumn.Right:
                        if (game.InputInstance.ButtonStates[Input.ButtonKind.Right] == Input.ButtonState.Press)
                        {
                            miss = true;
                        }
                        break;

                    default:
                        miss = false;
                        break;
                    }
                    if (miss && !nMiss)
                    {
                        nMiss = true;
                        chart.scoreHandler.Miss(true);
                        deadNotes.Add(item);
                    }
                }
                if ((item.noteInfo.time + chart.scoreTime) <= chart.beat)
                {
                    //darn issa miss
                    //Console.WriteLine("miss");
                    chart.scoreHandler.Miss(false);
                    deadNotes.Add(item);
                }
                //REALLLLY FEELS LIKE A BAD IDEA DOING THIS LIKE THIS
                item.freeze(this.frozen);
            }
            foreach (var item in deadNotes)
            {
                arrows.Remove(item);
                item.alive = false;
            }

            bool pressed = false;

            switch (collumn)
            {
            case Chart.collumn.Left:
                if (game.InputInstance.ButtonStates[Input.ButtonKind.Left] == Input.ButtonState.Held)
                {
                    pressed = true;
                }

                break;

            case Chart.collumn.Down:
                if (game.InputInstance.ButtonStates[Input.ButtonKind.Down] == Input.ButtonState.Held)
                {
                    pressed = true;
                }
                break;

            case Chart.collumn.Up:
                if (game.InputInstance.ButtonStates[Input.ButtonKind.Up] == Input.ButtonState.Held)
                {
                    pressed = true;
                }
                break;

            case Chart.collumn.Right:
                if (game.InputInstance.ButtonStates[Input.ButtonKind.Right] == Input.ButtonState.Held)
                {
                    pressed = true;
                }
                break;

            default:
                pressed = false;
                break;
            }
            if (pressed)
            {
                pressedVisual.z = 1;
            }
            else
            {
                pressedVisual.z = -2;
            }
        }