2019-01-24 08:43:03 +00: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-11 19:43:01 +00:00
|
|
|
|
|
2020-12-01 06:44:16 +00:00
|
|
|
|
using System;
|
2020-07-30 08:58:49 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-11-26 09:14:25 +00:00
|
|
|
|
using osu.Framework.Utils;
|
2020-07-30 08:58:49 +00:00
|
|
|
|
using osu.Game.Audio;
|
2018-08-02 06:28:48 +00:00
|
|
|
|
using osu.Game.Rulesets.Catch.Judgements;
|
2018-08-02 11:37:07 +00:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-11-26 09:14:25 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using osuTK.Graphics;
|
2018-08-02 06:28:48 +00:00
|
|
|
|
|
2018-06-11 19:43:01 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects
|
|
|
|
|
{
|
2020-11-26 09:14:25 +00:00
|
|
|
|
public class Banana : Fruit, IHasComboInformation
|
2018-06-11 19:43:01 +00:00
|
|
|
|
{
|
2020-07-30 08:58:49 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Index of banana in current shower.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int BananaIndex;
|
|
|
|
|
|
2018-08-06 02:50:18 +00:00
|
|
|
|
public override Judgement CreateJudgement() => new CatchBananaJudgement();
|
2020-07-30 08:58:49 +00:00
|
|
|
|
|
|
|
|
|
private static readonly List<HitSampleInfo> samples = new List<HitSampleInfo> { new BananaHitSampleInfo() };
|
|
|
|
|
|
|
|
|
|
public Banana()
|
|
|
|
|
{
|
|
|
|
|
Samples = samples;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-26 09:14:25 +00:00
|
|
|
|
private Color4? colour;
|
|
|
|
|
|
|
|
|
|
Color4 IHasComboInformation.GetComboColour(IReadOnlyList<Color4> comboColours)
|
|
|
|
|
{
|
|
|
|
|
// override any external colour changes with banananana
|
|
|
|
|
return colour ??= getBananaColour();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 06:44:16 +00:00
|
|
|
|
private class BananaHitSampleInfo : HitSampleInfo, IEquatable<BananaHitSampleInfo>
|
2020-07-30 08:58:49 +00:00
|
|
|
|
{
|
2020-12-01 06:44:16 +00:00
|
|
|
|
private static readonly string[] lookup_names = { "metronomelow", "catch-banana" };
|
2020-07-30 08:58:49 +00:00
|
|
|
|
|
2020-12-01 06:44:16 +00:00
|
|
|
|
public override IEnumerable<string> LookupNames => lookup_names;
|
2020-12-01 06:37:51 +00:00
|
|
|
|
|
|
|
|
|
public BananaHitSampleInfo()
|
|
|
|
|
: base(string.Empty)
|
|
|
|
|
{
|
|
|
|
|
}
|
2020-12-01 06:44:16 +00:00
|
|
|
|
|
|
|
|
|
public bool Equals(BananaHitSampleInfo other)
|
|
|
|
|
=> other != null;
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
2020-12-01 09:09:21 +00:00
|
|
|
|
=> obj is BananaHitSampleInfo other && Equals(other);
|
2020-12-01 06:44:16 +00:00
|
|
|
|
|
|
|
|
|
public override int GetHashCode() => lookup_names.GetHashCode();
|
2020-07-30 08:58:49 +00:00
|
|
|
|
}
|
2018-06-11 19:43:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|