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-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Allocation;
|
2020-01-09 04:43:44 +00:00
|
|
|
|
using osu.Framework.Utils;
|
2020-02-17 09:47:22 +00:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-02-19 09:01:59 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-11-24 08:03:26 +00:00
|
|
|
|
public class DrawableFruit : PalpableDrawableCatchHitObject
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-11-24 08:03:26 +00:00
|
|
|
|
public DrawableFruit(CatchHitObject h)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
: base(h)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
2020-02-19 08:28:40 +00:00
|
|
|
|
ScaleContainer.Child = new SkinnableDrawable(
|
|
|
|
|
new CatchSkinComponent(getComponent(HitObject.VisualRepresentation)), _ => new FruitPiece());
|
2020-03-10 10:30:31 +00:00
|
|
|
|
|
|
|
|
|
ScaleContainer.Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
|
2020-02-19 06:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-17 09:47:22 +00:00
|
|
|
|
private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-02-17 09:47:22 +00:00
|
|
|
|
switch (hitObjectVisualRepresentation)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-02-17 09:47:22 +00:00
|
|
|
|
case FruitVisualRepresentation.Pear:
|
|
|
|
|
return CatchSkinComponents.FruitPear;
|
|
|
|
|
|
|
|
|
|
case FruitVisualRepresentation.Grape:
|
|
|
|
|
return CatchSkinComponents.FruitGrapes;
|
2019-04-01 03:16:05 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
case FruitVisualRepresentation.Pineapple:
|
2020-02-17 09:47:22 +00:00
|
|
|
|
return CatchSkinComponents.FruitApple;
|
2019-04-01 03:16:05 +00:00
|
|
|
|
|
2020-02-19 05:31:43 +00:00
|
|
|
|
case FruitVisualRepresentation.Raspberry:
|
|
|
|
|
return CatchSkinComponents.FruitOrange;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
case FruitVisualRepresentation.Banana:
|
2020-02-17 09:47:22 +00:00
|
|
|
|
return CatchSkinComponents.FruitBananas;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-02-17 09:47:22 +00:00
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(hitObjectVisualRepresentation), hitObjectVisualRepresentation, null);
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|