Beispiel #1
0
 public IHeroController GetHeroController(HeroSide side)
 {
     if (side == HeroSide.Bottom)
     {
         return(BottomHeroController);
     }
     return(TopHeroController);
 }
Beispiel #2
0
    public static IProjectile CreateProjectile(Projectiles projectile, HeroSide side, Vector2 position)
    {
        var prefab = Game.Resources.LoadPrefab <Projectile>(projectilePaths[projectile]);

        prefab.Initialize(side, position);

        return(prefab);
    }
Beispiel #3
0
 public IPlayer GetPlayer(HeroSide side)
 {
     if (side == HeroSide.Top)
     {
         return(TopPlayer);
     }
     return(BottomPlayer);
 }
Beispiel #4
0
 public static HeroSide GetOppositeSide(HeroSide side)
 {
     if (side == HeroSide.Top)
     {
         return(HeroSide.Bottom);
     }
     return(HeroSide.Top);
 }
Beispiel #5
0
 public IHero GetHero(HeroSide side)
 {
     if (side == HeroSide.Bottom)
     {
         return(BottomHero);
     }
     return(TopHero);
 }
Beispiel #6
0
 public IPlayer GetEnemyPlayer(HeroSide side)
 {
     if (side == HeroSide.Bottom)
     {
         return(TopPlayer);
     }
     return(BottomPlayer);
 }
Beispiel #7
0
 public IGoal GetGoal(HeroSide side)
 {
     if (side == HeroSide.Bottom)
     {
         return(BottomGoal);
     }
     return(TopGoal);
 }
Beispiel #8
0
 public IGoal GetOpponentGoal(HeroSide side)
 {
     if (side == HeroSide.Top)
     {
         return(BottomGoal);
     }
     return(TopGoal);
 }
Beispiel #9
0
 public Vector2 GetHeroSpawn(HeroSide side)
 {
     if (side == HeroSide.Bottom)
     {
         return(BottomHeroSpawn);
     }
     return(TopHeroSpawn);
 }
Beispiel #10
0
 public IHero GetEnemyHero(HeroSide side)
 {
     if (side == HeroSide.Top)
     {
         return(BottomHero);
     }
     return(TopHero);
 }
Beispiel #11
0
    public static IHero CreateHero(GameObject entityRoot, Heroes hero, HeroSide side, Vector2 position)
    {
        var prefab = Game.Resources.LoadPrefab <Hero>(heroesPaths[hero]);

        entityRoot.AddChildEntity(prefab);
        prefab.Initialize(side, position);

        return(prefab);
    }
Beispiel #12
0
 public void AttachHero(HeroSide side, IHero hero)
 {
     if (side == HeroSide.Bottom)
     {
         friendlyHero = hero;
     }
     else
     {
         enemyHero = hero;
     }
 }
Beispiel #13
0
    public void Initialize(HeroSide side, Vector2 position)
    {
        this.side = side;
        this.transform.position = position;

        if (mover != null)
        {
            mover.Initialize(this, side);
        }

        OnCreate();
    }
Beispiel #14
0
    protected override void OnConstruct()
    {
        defaultSprite = this.AddChild(Game.Objects.CreatePrefab <SpriteWrapper>(defaultOrbSprite));
        ClearOrbBehavior();

        direction = startDirection;
        speed     = startSpeed;
        collider  = this.GetComponentStrict <CircleCollider2D>();

        respawnTimer = new Timer(1);
        state        = OrbState.Spawning;
        scoredSide   = HeroSide.Bottom;

        sprites = new Dictionary <HeroSide, ISpriteWrapper>();
    }
Beispiel #15
0
    public override void Initialize(IProjectile projectile, HeroSide side)
    {
        var pos = (Vector2)transform.position;

        if (side == HeroSide.Top)
        {
            goal = new Vector2(pos.x, Game.Levels.CurrentLevel.BottomGoal.Position.y);
        }
        else
        {
            goal = new Vector2(pos.x, Game.Levels.CurrentLevel.TopGoal.Position.y);
        }

        this.projectile = projectile;
        this.side       = side;
    }
Beispiel #16
0
    public IHero CreateHero(Heroes hero, HeroSide side)
    {
        var result = HeroFactory.CreateHero(entityRoot, hero, side, Game.Levels.CurrentLevel.GetHeroSpawn(side));

        if (side == HeroSide.Top)
        {
            Game.Hud.CurrentHud.ScoreBar.AttachHero(HeroSide.Top, result);
            TopHero = result;
        }
        else
        {
            Game.Hud.CurrentHud.ScoreBar.AttachHero(HeroSide.Bottom, result);
            BottomHero = result;
        }

        Game.Hud.CurrentHud.GetHeroController(side).AttachHero(result);

        return(result);
    }
Beispiel #17
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        IGoal goal = collision.gameObject.GetComponent <Goal>();

        if (goal != null)
        {
            if (currentBehavior != null)
            {
                currentBehavior.OnScore();
            }

            Game.Entities.GetEnemyPlayer(goal.Side).Score += 1;
            this.scoredSide = goal.Side;
            Game.FloatingText.CreateFloatingText("+1", TextStyles.Points, Game.Entities.GetEnemyHero(goal.Side).Position);
            Respawn();
        }

        IMinion minion = collision.gameObject.GetComponent <Minion>();

        if (minion != null)
        {
            if (currentBehavior != null)
            {
                if (minion.Owner.Side == currentBehavior.Owner.Side)
                {
                    currentBehavior.OnHitAllyMinion(minion);
                }
                else
                {
                    currentBehavior.HitEnemyMinion(minion);
                }
            }
        }

        IBumper bumper = collision.AsBumper();

        if (bumper != null)
        {
            timeOfLastBumperHit = Time.timeSinceLevelLoad;
            Vector2 collisionPoint = collision.bounds.ClosestPoint(this.Position);
            bumper.OnBump(this, collisionPoint);
        }
    }
Beispiel #18
0
 public void Initialize(HeroSide side, Heroes selectedHero)
 {
     this.SelectedHero = selectedHero;
     this.Side         = side;
 }
Beispiel #19
0
 public abstract void Initialize(IProjectile projectile, HeroSide side);
Beispiel #20
0
 public void Initialize(HeroSide side, Vector2 position)
 {
     this.transform.position = position;
     this.Side = side;
 }
Beispiel #21
0
        public override void EnemyTurn()
        {
            Random   random = new Random();
            Creature vamp   = EnemySide[0].creature;

            if (vamp != null)
            {
                Ability chosenAbility = null;
                if (Rounds % 10 == 0)
                {
                    chosenAbility = vamp.Abilities[1];
                }
                else
                {
                    chosenAbility = vamp.Abilities[0];
                }

                int index = -1;

                Space[] side = new Space[3];
                if (chosenAbility.TargetType == "Hero")
                {
                    HeroSide.CopyTo(side, 0);
                }
                else if (chosenAbility.TargetType == "Enemy")
                {
                    EnemySide.CopyTo(side, 0);
                }
                while (index < 0)
                {
                    index = random.Next(side.Length);
                    {
                        if (side[index].creature != null)
                        {
                            if (side[index].creature.CurrHP > 0)
                            {
                                chosenAbility.setTargets(side, index);
                            }
                            else
                            {
                                index = -1;
                            }
                        }
                        else
                        {
                            index = -1;
                        }
                    }
                }

                int open = random.Next(3);
                if (open == 0)
                {
                    vamp.TopMod    = 1;
                    vamp.FrontMod  = 0;
                    vamp.BottomMod = 0;
                    Console.WriteLine("\nVampire Chicken pokes its head out of the top of the eggshell.");
                    Console.ReadLine();
                }
                else if (open == 1)
                {
                    vamp.TopMod    = 0;
                    vamp.FrontMod  = 1;
                    vamp.BottomMod = 0;
                    Console.WriteLine("\nVampire Chicken pokes its head out of a hole in the front of the shell.");
                    Console.ReadLine();
                }
                else if (open == 2)
                {
                    vamp.TopMod    = 0;
                    vamp.FrontMod  = 0;
                    vamp.BottomMod = 1;
                    Console.WriteLine("\nVampire Chicken hangs upside down like a bat. His head touches the floor.");
                    Console.ReadLine();
                }

                chosenAbility.execute(vamp);
                chosenAbility.Targets.Clear();
            }
        }