Beispiel #1
0
 private void DrawHeroStats(DefaultHero hero)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(hero.name);
     GUILayout.Label("HP:" + hero.HP);
     GUILayout.Label(hero.IsReady() ? "Ready" : "Not Ready");
     GUILayout.EndHorizontal();
 }
Beispiel #2
0
        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 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));
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        public override void Execute()
        {
            //display ready hero in UI, hero.execute will move them from ready when they have a command.

            foreach (var hero in stateMachine.heroesToCommand)
            {
                if (hero.IsReady())
                {
                    DefaultHero.TakingCommandsEvent(hero);
                    hero.Execute();
                    break;
                }
            }

            if (stateMachine.heroesToCommand.All(hero => !hero.IsReady()))
            {
                stateMachine.ChangeState(typeof(BattleExecutePhase));
            }
        }
Beispiel #6
0
        public HeroBase Create(HeroData data, int placementIndex, int expectedNumberOfHeroes)
        {
            var go = new GameObject(data.Name, typeof(MeshFilter),
                                    typeof(MeshRenderer));

            go.GetComponent <MeshFilter>().mesh       = data.Mesh;
            go.GetComponent <MeshRenderer>().material = data.Material;

            DefaultHero newHeroInstance = new DefaultHero(go, data.Moves);

            newHeroInstance.name = data.Name;

            float lineupWidth = 6f;
            float distance    = lineupWidth / expectedNumberOfHeroes;
            float Zpos        = (placementIndex * distance) - (lineupWidth * 0.5f);

            go.transform.position = new Vector3(0, 0, Zpos);

            return(newHeroInstance);
        }
Beispiel #7
0
 private void TakingCommands(DefaultHero hero)
 {
     this.hero = hero;
 }
Beispiel #8
0
 public abstract void Perform(DefaultHero hero, EnemyDummy enemy);