void Start()
 {
     myCamera        = Camera.main;
     defendersParent = GameObject.Find("Defenders").transform;
     starCounter     = FindObjectOfType <StarCounter>();
     audioSource     = GetComponent <AudioSource>();
 }
Example #2
0
        public TestSceneStarCounter()
        {
            starCounter = new StarCounter
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
            };

            Add(starCounter);

            starsLabel = new OsuSpriteText
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
                Scale  = new Vector2(2),
                Y      = 50,
            };

            Add(starsLabel);

            setStars(5);

            AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
            AddSliderStep("exact value", 0f, 10f, 5f, setStars);
            AddStep("stop animation", () => starCounter.StopAnimation());
            AddStep("reset", () => setStars(0));
        }
Example #3
0
 private void Start()
 {
     starCountIndicators = GameObject.FindGameObjectsWithTag("StarCountIndicator");
     indicator           = Instantiate((GameObject)Resources.Load("prefabs/" + "starIcon", typeof(GameObject)));
     indicator.AddComponent <MinimapComponent>();
     indicator.GetComponent <MinimapComponent>().Target = transform;
     p = GameObject.FindGameObjectWithTag("StarCounter").GetComponent <StarCounter>();
 }
Example #4
0
 private void Start()
 {
     actionButtonPressed = false;
     starsCollected      = GameObject.FindGameObjectWithTag("StarsCollected").transform;
     p = GameObject.FindGameObjectWithTag("StarCounter").GetComponent <StarCounter>();
     starsConnectedCounter = GameObject.FindGameObjectWithTag("StarCounter").GetComponent <StarsConnectedCounter>();
     playerUI = GameObject.FindGameObjectWithTag("UI");
 }
    // Update is called once per frame
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == player)
        {
            Debug.Log("Star Collected");

            // 별 카운터의 변수를 올리고, 플레이어가 수집별의 개수를 1 증가한다.
            StarCounter starCounterScript = GameObject.Find("StarCounter").GetComponent <StarCounter>();
            starCounterScript.CollectedStar += 1;

            Debug.Log("Collected Star: " + starCounterScript.CollectedStar);

            // 오브젝트 삭제
            Destroy(gameObject);
        }
    }
Example #6
0
        public TeamScore(Bindable <int?> score, TeamColour colour, int count)
        {
            bool flip   = colour == TeamColour.Blue;
            var  anchor = flip ? Anchor.TopRight : Anchor.TopLeft;

            AutoSizeAxes = Axes.Both;

            InternalChild = counter = new TeamScoreStarCounter(count)
            {
                Anchor = anchor,
                Scale  = flip ? new Vector2(-1, 1) : Vector2.One,
            };

            currentTeamScore.BindValueChanged(scoreChanged);
            currentTeamScore.BindTo(score);
        }
Example #7
0
 // Update is called once per frame
 void Start()
 {
     thisStarVertex.starRef = gameObject;
     starCounter            = GameObject.FindGameObjectWithTag("StarCounter").GetComponent <StarCounter>();
     starsConnectedCounter  = GameObject.FindGameObjectWithTag("StarCounter").GetComponent <StarsConnectedCounter>();
     charge.Stop();
     fullyChargedSound.Stop();
     if (!hasPuzzle)
     {
         charge.Play();
         fullyChargedSound.Play();
         starCounter.AddCount();
         thisStarVertex.IsInPlace = true;
         thisStarVertex.CheckAndDrawLines(thisStarVertex);
     }
 }
Example #8
0
    protected override void Awake()
    {
        lives = PlayerPrefs.GetInt("HP");

        rigidbody   = GetComponent <Rigidbody2D>();
        animator    = GetComponent <Animator>();
        sprite      = GetComponent <SpriteRenderer>();
        healthBar   = FindObjectOfType <HealthBar>();
        manaBar     = FindObjectOfType <ManaBar>();
        starCounter = FindObjectOfType <StarCounter>();
        bullet      = Resources.Load <Bullet>("Bullet");
        coinCounter = FindObjectOfType <CoinCounter>();
        score       = 0;
        scoreInfo   = FindObjectOfType <Score>();
        damageTimer = 0;
        stars       = 0;
    }
    void Start()
    {
        health   = GetComponent <Health>();
        animator = GetComponent <Animator>();

        attackerSpawner = FindObjectOfType <AttackerSpawner>();
        starCounter     = FindObjectOfType <StarCounter>();

        if (!attackerSpawner)
        {
            Debug.LogError("Can't find attacker spawner!");
        }
        if (!starCounter)
        {
            Debug.LogError("Can't find star counter!");
        }
    }
            public TeamScore(Bindable <int?> score, bool flip, int count)
            {
                var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft;

                Anchor = anchor;
                Origin = anchor;

                InternalChild = counter = new StarCounter(count)
                {
                    Anchor = anchor,
                    X      = (flip ? -1 : 1) * 90,
                    Y      = 5,
                    Scale  = flip ? new Vector2(-1, 1) : Vector2.One,
                };

                currentTeamScore.BindValueChanged(scoreChanged);
                currentTeamScore.BindTo(score);
            }
Example #11
0
        public TestSceneStarCounter()
        {
            StarCounter stars = new StarCounter
            {
                Origin  = Anchor.Centre,
                Anchor  = Anchor.Centre,
                Current = 5,
            };

            Add(stars);

            SpriteText starsLabel = new OsuSpriteText
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
                Scale  = new Vector2(2),
                Y      = 50,
                Text   = stars.Current.ToString("0.00"),
            };

            Add(starsLabel);

            AddRepeatStep(@"random value", delegate
            {
                stars.Current   = RNG.NextSingle() * (stars.StarCount + 1);
                starsLabel.Text = stars.Current.ToString("0.00");
            }, 10);

            AddStep(@"Stop animation", delegate
            {
                stars.StopAnimation();
            });

            AddStep(@"Reset", delegate
            {
                stars.Current   = 0;
                starsLabel.Text = stars.Current.ToString("0.00");
            });
        }
Example #12
0
        public BeatmapPanel(BeatmapInfo beatmap)
        {
            Beatmap = beatmap;
            Height *= 0.60f;

            Children = new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                triangles = new Triangles
                {
                    TriangleScale    = 2,
                    RelativeSizeAxes = Axes.Both,
                    ColourLight      = OsuColour.FromHex(@"3a7285"),
                    ColourDark       = OsuColour.FromHex(@"123744")
                },
                new FillFlowContainer
                {
                    Padding      = new MarginPadding(5),
                    Direction    = FillDirection.Horizontal,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        new DifficultyIcon(beatmap)
                        {
                            Scale = new Vector2(1.8f),
                        },
                        new FillFlowContainer
                        {
                            Padding = new MarginPadding {
                                Left = 5
                            },
                            Direction    = FillDirection.Vertical,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-Medium",
                                            Text     = beatmap.Version,
                                            TextSize = 20,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-Medium",
                                            Text     = "mapped by",
                                            TextSize = 16,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-MediumItalic",
                                            Text     = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
                                            TextSize = 16,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                    }
                                },
                                starCounter = new StarCounter
                                {
                                    Count = (float)beatmap.StarDifficulty,
                                    Scale = new Vector2(0.8f),
                                }
                            }
                        }
                    }
                }
            };
        }
Example #13
0
        public override void Reset()
        {
            base.Reset();

            int numerator = 0, denominator = 0;

            bool maniaHold = false;

            ScoreCounter score = new ScoreCounter(7)
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                TextSize = 40,
                Count    = 0,
                Margin   = new MarginPadding(20),
            };

            Add(score);

            ComboCounter standardCombo = new OsuComboCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Margin   = new MarginPadding(10),
                Count    = 0,
                TextSize = 40,
            };

            Add(standardCombo);

            CatchComboCounter catchCombo = new CatchComboCounter
            {
                Origin   = Anchor.Centre,
                Anchor   = Anchor.Centre,
                Count    = 0,
                TextSize = 40,
            };

            Add(catchCombo);

            ComboCounter taikoCombo = new TaikoComboCounter
            {
                Origin   = Anchor.BottomCentre,
                Anchor   = Anchor.Centre,
                Position = new Vector2(0, -160),
                Count    = 0,
                TextSize = 40,
            };

            Add(taikoCombo);

            ManiaComboCounter maniaCombo = new ManiaComboCounter
            {
                Origin   = Anchor.Centre,
                Anchor   = Anchor.Centre,
                Position = new Vector2(0, -80),
                Count    = 0,
                TextSize = 40,
            };

            Add(maniaCombo);


            PercentageCounter accuracyCombo = new PercentageCounter
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                Position = new Vector2(-20, 60),
            };

            Add(accuracyCombo);

            StarCounter stars = new StarCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -160),
                Count    = 5,
            };

            Add(stars);

            SpriteText starsLabel = new SpriteText
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -190),
                Text     = stars.Count.ToString("0.00"),
            };

            Add(starsLabel);

            AddButton(@"Reset all", delegate
            {
                score.Count         = 0;
                standardCombo.Count = 0;
                taikoCombo.Count    = 0;
                maniaCombo.Count    = 0;
                catchCombo.Count    = 0;
                numerator           = denominator = 0;
                accuracyCombo.SetFraction(0, 0);
                stars.Count     = 0;
                starsLabel.Text = stars.Count.ToString("0.00");
            });

            AddButton(@"Hit! :D", delegate
            {
                score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0);
                standardCombo.Count++;
                taikoCombo.Count++;
                maniaCombo.Count++;
                catchCombo.CatchFruit(new Color4(
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          1)
                                      );
                numerator++; denominator++;
                accuracyCombo.SetFraction(numerator, denominator);
            });

            AddButton(@"miss...", delegate
            {
                standardCombo.Roll();
                taikoCombo.Roll();
                maniaCombo.Roll();
                catchCombo.Roll();
                denominator++;
                accuracyCombo.SetFraction(numerator, denominator);
            });

            AddButton(@"mania hold", delegate
            {
                if (!maniaHold)
                {
                    maniaCombo.HoldStart();
                }
                else
                {
                    maniaCombo.HoldEnd();
                }
                maniaHold = !maniaHold;
            });

            AddButton(@"Alter stars", delegate
            {
                stars.Count     = RNG.NextSingle() * (stars.MaxStars + 1);
                starsLabel.Text = stars.Count.ToString("0.00");
            });

            AddButton(@"Stop counters", delegate
            {
                score.StopRolling();
                standardCombo.StopRolling();
                catchCombo.StopRolling();
                taikoCombo.StopRolling();
                maniaCombo.StopRolling();
                accuracyCombo.StopRolling();
                stars.StopAnimation();
            });
        }
        private void load(BeatmapManager manager, SongSelect songSelect)
        {
            Header.Height = height;

            if (songSelect != null)
            {
                startRequested = b => songSelect.FinaliseSelection(b);
                if (songSelect.AllowEditing)
                {
                    editRequested = songSelect.Edit;
                }
            }

            if (manager != null)
            {
                hideRequested = manager.Hide;
            }

            Header.Children = new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                triangles = new Triangles
                {
                    TriangleScale    = 2,
                    RelativeSizeAxes = Axes.Both,
                    ColourLight      = Color4Extensions.FromHex(@"3a7285"),
                    ColourDark       = Color4Extensions.FromHex(@"123744")
                },
                new FillFlowContainer
                {
                    Padding      = new MarginPadding(5),
                    Direction    = FillDirection.Horizontal,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        new DifficultyIcon(beatmapInfo, shouldShowTooltip: false)
                        {
                            Scale = new Vector2(1.8f),
                        },
                        new FillFlowContainer
                        {
                            Padding = new MarginPadding {
                                Left = 5
                            },
                            Direction    = FillDirection.Vertical,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Text   = beatmapInfo.Version,
                                            Font   = OsuFont.GetFont(size: 20),
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Text   = "mapped by",
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Text   = $"{(beatmapInfo.Metadata ?? beatmapInfo.BeatmapSet.Metadata).Author.Username}",
                                            Font   = OsuFont.GetFont(italics: true),
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        new TopLocalRank(beatmapInfo)
                                        {
                                            Scale = new Vector2(0.8f),
                                            Size  = new Vector2(40, 20)
                                        },
                                        starCounter = new StarCounter
                                        {
                                            Scale = new Vector2(0.8f),
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }
Example #15
0
        private void load(SongSelect songSelect, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay)
        {
            this.beatmapOverlay = beatmapOverlay;

            if (songSelect != null)
            {
                startRequested = b => songSelect.FinaliseSelection(b);
                editRequested  = songSelect.Edit;
            }

            if (manager != null)
            {
                hideRequested = manager.Hide;
            }

            Children = new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                triangles = new Triangles
                {
                    TriangleScale    = 2,
                    RelativeSizeAxes = Axes.Both,
                    ColourLight      = OsuColour.FromHex(@"3a7285"),
                    ColourDark       = OsuColour.FromHex(@"123744")
                },
                new FillFlowContainer
                {
                    Padding      = new MarginPadding(5),
                    Direction    = FillDirection.Horizontal,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        new DifficultyIcon(beatmap)
                        {
                            Scale = new Vector2(1.8f),
                        },
                        new FillFlowContainer
                        {
                            Padding = new MarginPadding {
                                Left = 5
                            },
                            Direction    = FillDirection.Vertical,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-Medium",
                                            Text     = beatmap.Version,
                                            TextSize = 20,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-Medium",
                                            Text     = "mapped by",
                                            TextSize = 16,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Font     = @"Exo2.0-MediumItalic",
                                            Text     = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author.Username}",
                                            TextSize = 16,
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft
                                        },
                                    }
                                },
                                starCounter = new StarCounter
                                {
                                    CountStars = (float)beatmap.StarDifficulty,
                                    Scale      = new Vector2(0.8f),
                                }
                            }
                        }
                    }
                }
            };
        }
Example #16
0
 // Use this for initialization
 void Start()
 {
     starCounter  = GameObject.Find("Star Counter").GetComponent <StarCounter>();
     damageSource = GetComponent <AudioSource>();
 }
Example #17
0
        public TestCaseScoreCounter()
        {
            int numerator = 0, denominator = 0;

            ScoreCounter score = new ScoreCounter(7)
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                TextSize = 40,
                Margin   = new MarginPadding(20),
            };

            Add(score);

            ComboCounter comboCounter = new StandardComboCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Margin   = new MarginPadding(10),
                TextSize = 40,
            };

            Add(comboCounter);

            PercentageCounter accuracyCounter = new PercentageCounter
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                Position = new Vector2(-20, 60),
            };

            Add(accuracyCounter);

            StarCounter stars = new StarCounter
            {
                Origin     = Anchor.BottomLeft,
                Anchor     = Anchor.BottomLeft,
                Position   = new Vector2(20, -160),
                CountStars = 5,
            };

            Add(stars);

            SpriteText starsLabel = new SpriteText
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -190),
                Text     = stars.CountStars.ToString("0.00"),
            };

            Add(starsLabel);

            AddStep(@"Reset all", delegate
            {
                score.Current.Value        = 0;
                comboCounter.Current.Value = 0;
                numerator = denominator = 0;
                accuracyCounter.SetFraction(0, 0);
                stars.CountStars = 0;
                starsLabel.Text  = stars.CountStars.ToString("0.00");
            });

            AddStep(@"Hit! :D", delegate
            {
                score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0);
                comboCounter.Increment();
                numerator++;
                denominator++;
                accuracyCounter.SetFraction(numerator, denominator);
            });

            AddStep(@"miss...", delegate
            {
                comboCounter.Current.Value = 0;
                denominator++;
                accuracyCounter.SetFraction(numerator, denominator);
            });

            AddStep(@"Alter stars", delegate
            {
                stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1);
                starsLabel.Text  = stars.CountStars.ToString("0.00");
            });

            AddStep(@"Stop counters", delegate
            {
                score.StopRolling();
                comboCounter.StopRolling();
                accuracyCounter.StopRolling();
                stars.StopAnimation();
            });
        }
Example #18
0
 // Use this for initialization
 void Start()
 {
     finalScore = GetComponent <Text>();
     starCount  = GameObject.Find("Star Counter").GetComponent <StarCounter>();
 }
Example #19
0
 // Use this for initialization
 void Awake()
 {
     starCounter = GameObject.Find("Star Counter").GetComponent <StarCounter>();
 }