public static Func <bool> DamageCommand(EnemyDummy enemy, int damage) { return(() => { enemy.Damage(damage); return true; }); }
public override void Perform(DefaultHero hero, EnemyDummy enemy) { var startingPosition = hero.gameObject.transform.position; var targetPosition = startingPosition.With(x: startingPosition.x + 1); hero.commands.AddCommand( Commands.MoveToCommand(hero.gameObject.transform, targetPosition, movespeed)); hero.commands.AddCommand( Commands.DamageCommand(enemy, damage)); hero.commands.AddCommand( Commands.MoveToCommand(hero.gameObject.transform, startingPosition, movespeed)); }
public Enemy Create(EnemyData data, Vector3 position) { var go = new GameObject(data.Name, typeof(MeshFilter), typeof(MeshRenderer)); go.GetComponent <MeshFilter>().mesh = data.Mesh; go.GetComponent <MeshRenderer>().material = data.Material; EnemyDummy e = new EnemyDummy(go); go.transform.position = position; return(e); }
public override void Perform(DefaultHero hero, EnemyDummy enemy) { var heroTransform = hero.gameObject.transform; var enemyTransform = enemy.gameObject.transform; var startingPosition = heroTransform.position; var targetPosition = (startingPosition - enemyTransform.position).normalized + enemyTransform.position; hero.commands.AddCommand( Commands.MoveToCommand(hero.gameObject.transform, targetPosition, movespeed)); hero.commands.AddCommand( Commands.DamageCommand(enemy, damage)); hero.commands.AddCommand( Commands.MoveToCommand(hero.gameObject.transform, startingPosition, movespeed)); }
private void Awake() { boss = (EnemyDummy) new DummyFactory().Create(bossData, new Vector3(12, 0, 0)); heroes = new List <DefaultHero>(party.partyHeroes.Count); var heroFactory = new DefaultHeroFactory(); for (int i = 0; i < party.partyHeroes.Count; i++) { DefaultHero newHero = (DefaultHero)heroFactory.Create(party.partyHeroes[i], i, party.partyHeroes.Count); newHero.targetEnemy = boss; heroes.Add(newHero); } manager = new BattleManager(heroes); ui = new GameUI(heroes); }
public abstract void Perform(DefaultHero hero, EnemyDummy enemy);