Example #1
0
        public void CreateNote(int ID, int Size, Color32 Color, NoteInfo Mode, FlickMode Flick, float Time, float Speed, float Start, float End, List <int> Prev)
        {
            if (Mode.Equals(NoteInfo.SlideNoteStart))
            {
                CreateNote(ID, Size, Color, NoteInfo.SystemNoteSlideDummy, Flick, Time, Speed, Start, End, new List <int>());
            }

            GameObject newNote  = null;
            Note       noteComp = null;

            if (Game.Mode.Equals(GameMode.Starlight))
            {
                if (Size <= 1)
                {
                    newNote = Instantiate(Game.StarlightNote) as GameObject;
                }
                else
                {
                    newNote = Instantiate(Game.StarlightXL) as GameObject;
                }
                noteComp = newNote.GetComponent <StarlightNote>();
            }
            else if (Game.Mode.Equals(GameMode.Theater) || Game.Mode.Equals(GameMode.Theater4) || Game.Mode.Equals(GameMode.Theater2L) || Game.Mode.Equals(GameMode.Theater2P))
            {
                if (Size.Equals(0))
                {
                    newNote = Instantiate(Game.TheaterSmall) as GameObject;
                }
                else if (Size.Equals(1))
                {
                    newNote = Instantiate(Game.TheaterLarge) as GameObject;
                }
                else if (Size > 1)
                {
                    newNote = Instantiate(Game.TheaterXL) as GameObject;
                }
                noteComp = newNote.GetComponent <TheaterNote>();
            }
            else if (Game.Mode.Equals(GameMode.Platinum))
            {
                if (Size.Equals(0))
                {
                    newNote = Instantiate(Game.PlatinumSmall) as GameObject;
                }
                else if (Size.Equals(1))
                {
                    newNote = Instantiate(Game.PlatinumLarge) as GameObject;
                }
                else if (Size > 1)
                {
                    newNote = Instantiate(Game.PlatinumXL) as GameObject;
                }
                noteComp = newNote.GetComponent <PlatinumNote>();
            }
            newNote.GetComponent <RectTransform>().SetParent(Game.NoteParent, false);
            float resist = 0;

            if (!Flick.Equals(FlickMode.None))
            {
                int flickVal;
                if (PlayerPrefs.HasKey("flickmode"))
                {
                    flickVal = PlayerPrefs.GetInt("flickmode");
                }
                else
                {
                    flickVal = 1;
                }
                if (flickVal.Equals(0))
                {
                    resist = 20;
                }
                else if (flickVal.Equals(1))
                {
                    resist = 40;
                }
                else if (flickVal.Equals(2))
                {
                    resist = 60;
                }
                else if (flickVal.Equals(3))
                {
                    // TODO 하기
                    //if (!Game.Mode.Equals(GameMode.Starlight)) { resist = 35; }
                    if (Game.Mode.Equals(GameMode.Starlight))
                    {
                        bool applied = false;
                        for (int i = 0; i < Prev.Count; i++)
                        {
                            if (!Notes[Prev[i]].Flick.Equals(FlickMode.None))
                            {
                                float decVal;
                                if (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame < 4)
                                {
                                    decVal = 20;
                                }
                                else if (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame >= 20)
                                {
                                    decVal = 60;
                                }
                                else
                                {
                                    decVal = 20 + (2.5f * (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame - 4));
                                }
                                Notes[Prev[i]].FlickThreshold = decVal;
                                resist  = decVal;
                                applied = true;
                            }
                        }
                        if (!applied)
                        {
                            resist = 40;
                        }
                    }
                    else
                    {
                        resist = 50;
                    }
                }
            }
            noteComp.SetNote(ID, Start, End, Time * (1 / Game.ScrollAmp), Speed, resist, Mode, Flick, Color, Prev, 0);
            if ((int)noteComp.Mode < 10)
            {
                if (!Game.Judger.NoteQueue.ContainsKey(noteComp.EndLine))
                {
                    Game.Judger.MakeNewKey(noteComp.EndLine);
                }
                Game.Judger.NoteQueue[noteComp.EndLine].Add(noteComp.ID);
            }
            if (!Mode.Equals(NoteInfo.SystemNoteSlideDummy))
            {
                Notes.Add(ID, noteComp);
                NoteCount++;
            }
            else
            {
                Notes.Add(XLNoteID--, noteComp);
            }
            for (int i = 0; i < Prev.Count; i++)
            {
                Notes[Prev[i]].NextNoteID = ID;
                Notes[Prev[i]].CreateTailConnector();
                if (Game.Mode.Equals(GameMode.Theater) || Game.Mode.Equals(GameMode.Theater4) || Game.Mode.Equals(GameMode.Theater2L) || Game.Mode.Equals(GameMode.Theater2P))
                {
                    if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) ||
                         Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) ||
                         Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Size.Equals(0))
                    {
                        (Notes[Prev[i]] as TheaterNote).SizeInPixelNext = 70;
                    }
                    else if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) ||
                              Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) ||
                              Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Notes[Prev[i]].SizeInPixel.Equals(70))
                    {
                        (Notes[ID] as TheaterNote).SizeInPixelPrev = 70;
                    }
                }
                else if (Game.Mode.Equals(GameMode.Platinum))
                {
                    if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) ||
                         Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) ||
                         Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Size.Equals(0))
                    {
                        (Notes[Prev[i]] as PlatinumNote).SizeInPixelNext = 70;
                    }
                    else if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) ||
                              Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) ||
                              Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Notes[Prev[i]].SizeInPixel.Equals(70))
                    {
                        (Notes[ID] as PlatinumNote).SizeInPixelPrev = 70;
                    }
                }
            }
            if ((int)noteComp.Mode < 7)
            {
                VisibleNoteCount++;
            }

            if (Mode.Equals(NoteInfo.SystemNoteScroller)) // 스크롤러일 경우 배수 값을 저장합니다.
            {
                CurScrollVal = Speed;
            }

            if (Size >= 2) // 스페셜 노트가 나타났을 경우
            {
                XLReachFrame = Time * (1 / Game.ScrollAmp);
                if (!XLAppeared) // 그중 처음일 경우
                {
                    GameObject xlStart = GetNoteInstance();
                    xlStart.GetComponent <RectTransform>().SetParent(Game.NoteParent, false);
                    xlStart.GetComponent <Note>().Game = Game;
                    xlStart.GetComponent <Note>().SetNote(XLNoteID, 0, 0, (Time * (1 / Game.ScrollAmp)) - (45 * CurScrollVal), Game.GlobalNoteSpeed, 0, NoteInfo.SystemNoteXLStarter, FlickMode.None, new Color32(0, 0, 0, 0), new List <int>(), 0);
                    Notes.Add(XLNoteID--, xlStart.GetComponent <Note>());
                    XLAppeared = true;
                }
            }
            else if (Size < 2 && XLAppeared) // 스페셜 노트 이후 첫 다른 노트가 나타날 경우
            {
                GameObject xlEnd = GetNoteInstance();
                xlEnd.GetComponent <RectTransform>().SetParent(Game.NoteParent, false);
                xlEnd.GetComponent <Note>().Game = Game;
                xlEnd.GetComponent <Note>().SetNote(XLNoteID, 0, 0, (Time * (1 / Game.ScrollAmp)) - (90 * CurScrollVal) >= XLReachFrame + 15 ? (Time * (1 / Game.ScrollAmp)) - (90 * CurScrollVal) : XLReachFrame + 15, Game.GlobalNoteSpeed, 0, NoteInfo.SystemNoteXLEnder, FlickMode.None, new Color32(0, 0, 0, 0), new List <int>(), 0);
                Notes.Add(XLNoteID--, xlEnd.GetComponent <Note>());
                XLAppeared = false;
            }
        }
Example #2
0
        public Sprite GetNoteTexture(NoteInfo mode, FlickMode flick)
        {
            Sprite text = null;

            if (Mode.Equals(GameMode.Starlight) || Mode.Equals(GameMode.Platinum))
            {
                if (!flick.Equals(FlickMode.None))
                {
                    text = Instantiate(IsNoteColored ? StarlightWhite[(int)flick] : StarlightTexture[(int)flick]) as Sprite;
                }
                else
                {
                    if (mode.Equals(NoteInfo.NormalNote))
                    {
                        text = Instantiate(IsNoteColored ? StarlightWhite[0] : StarlightTexture[0]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.LongNoteStart) || mode.Equals(NoteInfo.LongNoteEnd))
                    {
                        text = Instantiate(IsNoteColored ? StarlightWhite[5] : StarlightTexture[5]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.SlideNoteStart) || mode.Equals(NoteInfo.SlideNoteEnd) || mode.Equals(NoteInfo.SystemNoteSlideDummy))
                    {
                        text = Instantiate(IsNoteColored ? StarlightWhite[6] : StarlightTexture[6]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.SlideNoteCheckpoint))
                    {
                        text = Instantiate(IsNoteColored ? StarlightWhite[7] : StarlightTexture[7]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.DamageNote))
                    {
                        text = Instantiate(IsNoteColored ? StarlightWhite[8] : StarlightTexture[8]) as Sprite;
                    }
                }
            }
            else
            {
                if (!flick.Equals(FlickMode.None))
                {
                    text = Instantiate(IsNoteColored ? WhiteTexture[(int)flick] : NoteTexture[(int)flick]) as Sprite;
                }
                else
                {
                    if (mode.Equals(NoteInfo.NormalNote))
                    {
                        text = Instantiate(IsNoteColored ? WhiteTexture[0] : NoteTexture[0]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.LongNoteStart) || mode.Equals(NoteInfo.LongNoteEnd))
                    {
                        text = Instantiate(IsNoteColored ? WhiteTexture[5] : NoteTexture[5]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.SlideNoteStart) || mode.Equals(NoteInfo.SlideNoteEnd) || mode.Equals(NoteInfo.SystemNoteSlideDummy))
                    {
                        text = Instantiate(IsNoteColored ? WhiteTexture[6] : NoteTexture[6]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.SlideNoteCheckpoint))
                    {
                        text = Instantiate(IsNoteColored ? WhiteTexture[7] : NoteTexture[7]) as Sprite;
                    }
                    else if (mode.Equals(NoteInfo.DamageNote))
                    {
                        text = Instantiate(IsNoteColored ? WhiteTexture[8] : NoteTexture[8]) as Sprite;
                    }
                }
            }
            return(text);
        }
Example #3
0
 /// <summary>
 /// 게임의 판정을 총괄하는 함수입니다. 판정 절차가 이루어졌으면 true, 그렇지 않으면 false를 반환합니다.
 /// </summary>
 /// <param name="gMode">게임의 모드입니다.</param>
 /// <param name="nMode">판정될 노트의 모드입니다.</param>
 /// <param name="fMode">판정될 노트의 플릭 여부입니다.</param>
 /// <param name="MyFrame">판정될 노트의 현재 프레임 값입니다.</param>
 /// <param name="RefFrame">판정될 노트의 기준 프레임 값입니다.</param>
 /// <param name="HasInput">사용자의 입력에 의한 판정인지의 여부입니다.</param>
 /// <returns>판정이 진행되었는지의 여부입니다.</returns>
 public bool HitJudge(GameMode gMode, NoteInfo nMode, FlickMode fMode, float MyFrame, float RefFrame, bool HasInput)
 {
     if (nMode.Equals(NoteInfo.DamageNote))
     {
         if (HasInput)
         {
             if (MyFrame < RefFrame - BadBorder)
             {
                 return(false);
             }
             else
             {
                 DecisionProcess(0, fMode);
             }
         }
         else
         {
             DecisionProcess(5, fMode);
         }
     }
     else if (fMode.Equals(0) && (nMode.Equals(NoteInfo.NormalNote) || nMode.Equals(NoteInfo.HiddenNote)))
     {
         if (MyFrame < RefFrame - BadBorder)
         {
             return(false);
         }
         else if (MyFrame >= RefFrame - BadBorder && MyFrame < RefFrame - NiceBorder)
         {
             DecisionProcess(1, fMode);
         }
         else if (MyFrame >= RefFrame - NiceBorder && MyFrame < RefFrame - GreatBorder)
         {
             DecisionProcess(2, fMode);
         }
         else if (MyFrame >= RefFrame - GreatBorder && MyFrame < RefFrame - PerfectBorder)
         {
             DecisionProcess(3, fMode);
         }
         else if (MyFrame >= RefFrame - PerfectBorder && MyFrame < RefFrame - 0.5f)
         {
             DecisionProcess(4, fMode);
         }
         else if (MyFrame >= RefFrame - 0.5f && MyFrame <= RefFrame + 0.5f)
         {
             DecisionProcess(5, fMode);
         }
         else if (MyFrame > RefFrame + 0.5f && MyFrame <= RefFrame + PerfectBorder)
         {
             DecisionProcess(4, fMode);
         }
         else if (MyFrame > RefFrame + PerfectBorder && MyFrame <= RefFrame + GreatBorder)
         {
             if (nMode.Equals(NoteInfo.HiddenNote))
             {
                 return(false);
             }
             else
             {
                 DecisionProcess(3, fMode);
             }
         }
         else if (MyFrame > RefFrame + GreatBorder && MyFrame <= RefFrame + NiceBorder)
         {
             if (nMode.Equals(NoteInfo.HiddenNote))
             {
                 return(false);
             }
             else
             {
                 DecisionProcess(2, fMode);
             }
         }
         else if (MyFrame > RefFrame + NiceBorder && MyFrame <= RefFrame + BadBorder)
         {
             if (nMode.Equals(NoteInfo.HiddenNote))
             {
                 return(false);
             }
             else
             {
                 DecisionProcess(1, fMode);
             }
         }
         else if (MyFrame > RefFrame + BadBorder)
         {
             if (nMode.Equals(NoteInfo.HiddenNote))
             {
                 return(false);
             }
             else
             {
                 DecisionProcess(0, fMode);
             }
         }
     }
     else
     {
         if (MyFrame < RefFrame - BadBorderL)
         {
             if (nMode.Equals(NoteInfo.LongNoteEnd) || nMode.Equals(NoteInfo.SlideNoteEnd))
             {
                 DecisionProcess(0, fMode);
             }
             else
             {
                 return(false);
             }
         }
         else if (MyFrame >= RefFrame - BadBorderL && MyFrame < RefFrame - NiceBorderL)
         {
             DecisionProcess(1, fMode);
         }
         else if (MyFrame >= RefFrame - NiceBorderL && MyFrame < RefFrame - GreatBorderL)
         {
             DecisionProcess(2, fMode);
         }
         else if (MyFrame >= RefFrame - GreatBorderL && MyFrame < RefFrame - PerfectBorderL)
         {
             DecisionProcess(3, fMode);
         }
         else if (MyFrame >= RefFrame - PerfectBorderL && MyFrame < RefFrame - 0.5f)
         {
             DecisionProcess(4, fMode);
         }
         else if (MyFrame >= RefFrame - 0.5f && MyFrame <= RefFrame + 0.5f)
         {
             DecisionProcess(5, fMode);
         }
         else if (MyFrame > RefFrame + 0.5f && MyFrame <= RefFrame + PerfectBorderL)
         {
             DecisionProcess(4, fMode);
         }
         else if (MyFrame > RefFrame + PerfectBorderL && MyFrame <= RefFrame + GreatBorderL)
         {
             DecisionProcess(3, fMode);
         }
         else if (MyFrame > RefFrame + GreatBorderL && MyFrame <= RefFrame + NiceBorderL)
         {
             DecisionProcess(2, fMode);
         }
         else if (MyFrame > RefFrame + NiceBorderL && MyFrame <= RefFrame + BadBorderL)
         {
             DecisionProcess(1, fMode);
         }
         else if (MyFrame > RefFrame + BadBorderL)
         {
             DecisionProcess(0, fMode);
         }
     }
     return(true);
 }