2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-06-10 08:38:17 +08:00
|
|
|
|
|
2020-02-19 14:16:19 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-10 14:59:13 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2020-02-19 13:31:32 +08:00
|
|
|
|
using osu.Framework.Utils;
|
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
2020-02-19 17:01:59 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
2018-06-10 08:38:17 +08:00
|
|
|
|
{
|
|
|
|
|
public class DrawableBanana : DrawableFruit
|
|
|
|
|
{
|
2018-06-12 03:43:01 +08:00
|
|
|
|
public DrawableBanana(Banana h)
|
2018-06-10 08:38:17 +08:00
|
|
|
|
: base(h)
|
|
|
|
|
{
|
|
|
|
|
}
|
2020-02-19 13:31:32 +08:00
|
|
|
|
|
|
|
|
|
private Color4? colour;
|
|
|
|
|
|
2020-02-20 14:37:15 +08:00
|
|
|
|
protected override Color4 GetComboColour(IReadOnlyList<Color4> comboColours)
|
2020-02-19 13:31:32 +08:00
|
|
|
|
{
|
|
|
|
|
// override any external colour changes with banananana
|
2020-02-20 14:37:15 +08:00
|
|
|
|
return colour ??= getBananaColour();
|
2020-02-19 13:31:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 14:59:13 +08:00
|
|
|
|
protected override void UpdateInitialTransforms()
|
|
|
|
|
{
|
|
|
|
|
base.UpdateInitialTransforms();
|
|
|
|
|
|
|
|
|
|
const float end_scale = 0.6f;
|
|
|
|
|
const float random_scale_range = 1.6f;
|
|
|
|
|
|
|
|
|
|
ScaleContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RNG.NextSingle()))
|
|
|
|
|
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
|
|
|
|
|
|
2020-03-11 14:54:03 +08:00
|
|
|
|
ScaleContainer.RotateTo(getRandomAngle())
|
|
|
|
|
.Then()
|
|
|
|
|
.RotateTo(getRandomAngle(), HitObject.TimePreempt);
|
2020-03-10 14:59:13 +08:00
|
|
|
|
|
2020-03-11 14:54:03 +08:00
|
|
|
|
float getRandomAngle() => 180 * (RNG.NextSingle() * 2 - 1);
|
2020-03-10 14:59:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-30 16:58:49 +08:00
|
|
|
|
public override void PlaySamples()
|
|
|
|
|
{
|
|
|
|
|
base.PlaySamples();
|
|
|
|
|
if (Samples != null)
|
|
|
|
|
Samples.Frequency.Value = 0.77f + ((Banana)HitObject).BananaIndex * 0.006f;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-19 13:31:32 +08:00
|
|
|
|
private Color4 getBananaColour()
|
|
|
|
|
{
|
|
|
|
|
switch (RNG.Next(0, 3))
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
return new Color4(255, 240, 0, 255);
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
return new Color4(255, 192, 0, 255);
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
return new Color4(214, 221, 28, 255);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-10 08:38:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|