I am learning design patters and I need your expierence. I want to improve. I am creating random project which should have solid patterns. Please help me to find mistakes.
So about project. I wonder how League of Legends game D.P looks like. Lets say I want to create champions patters. What is best way to create SpecialMove method? What interfaces should be created? Should I create logic about Q W E R method in Vayne class or should I create new class like VayneBattleLogic?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
}
}
class Champion
{
protected string ChampionName { get; set; }
protected Champion(string championName)
{
this.ChampionName = championName;
}
}
abstract class Ranger : Champion
{
public abstract void SpecialMove();// But every champion has different Special move. If I place it into Character class, I must implement it in Ranger class, but there, I still don't know the logic.. Maybe interface for Vayne class?
protected void PrepareArror()
{
// logic
}
protected Ranger(string ChampionName)
: base(ChampionName)
{
}
}
/// <summary>
/// Vayne is Ranger.
/// </summary>
internal class Vayne : Ranger
{
public Vayne()
: base("Vayne")
{
}
public void PrepareSilverBolt()
{
// Logic
}
public override void SpecialMove()
{
// Logic
}
}
}
Aucun commentaire:
Enregistrer un commentaire