Beispiel #1
0
 public AI(IEnemy enemy, string type)
 {
     if (type == "Enemy")
     {
         AIType = new EnemyAI(enemy);
     }
 }
 public EnemyEnemyCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     enemyA = (IEnemy)collision.GameObjectA;
     enemyB = (IEnemy)collision.GameObjectB;
     side = (ICollisionSide)collision.CollisionSide;
 }
 public override void Hit(IEnemy other, Vector2 direction)
 {
     if (other.CurrentState.CanHarmOtherEnemies() && CanHarmOtherEnemies())
         Enemy.Velocity *= -Utility.ONE;
     else
         other.Kill();
 }
        public Bandit(IEnemy enemyObject)
        {
            this.parent = enemyObject;
            this.Position = parent.Position;

            sprite = AnimatedSpriteFactory.Instance.BuildBanditSprite(parent.Position);
            this.CollisionRectangle = sprite.SpriteDestinationRectangle;
        }
	// 通知敵人單位陣亡
	public override void SetParam( System.Object Param )
	{
		base.SetParam( Param);
		m_Enemy = Param as IEnemy;
		m_KilledCount ++;

		// 通知
		Notify();
	}
		// 敵方單位陣亡
		private void Notify_EnemyKilled(IEnemy theEnemy )
		{
			// 陣亡數增加
			m_EnemyKilledCount++;

			// 擊倒裝備Rocket 的Ogre
			if( theEnemy.GetEnemyType() == ENUM_Enemy.Ogre && theEnemy.GetWeapon().GetWeaponType() == ENUM_Weapon.Rocket)
				m_KillOgreEquipRocket = true;
		}
Beispiel #7
0
        public void ReportEnemyHit(IEnemy enemy, IShot shot)
        {
            enemy.SubtractHealth(shot.FirePower);

            // Todo: Ugly..
            if (enemy.IsBoss && enemy.Health <= 0)
            {
                this.IsBossEliminated = true;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Add a new pointer for this enemy.
        /// </summary>
        /// <param name="enemy">will make pointer for this enemy</param>
        void OnEnemyCreated(IEnemy enemy) {
            GameObject pointerObject = Instantiate(enemyPointer);

            EnemyPointerWidget pointer = pointerObject.GetComponent<EnemyPointerWidget>();
            
            pointer.enemy = enemy;
            pointer.transform.parent = transform;
            pointer.transform.position = Vector3.zero;

            enemy.destroyed += OnEnemyDestroyed;

            pointers.Add(pointer);
        }
Beispiel #9
0
        public virtual void Hit(IEnemy other, Vector2 direction)
        {            
            if (other.CurrentState.CanHarmOtherEnemies()) {               
                Enemy.Kill();               
            } else {
                if (Enemy.Velocity.X > Utility.ZERO && other.Velocity.X > Utility.ZERO || Enemy.Velocity.X < Utility.ZERO && other.Velocity.X < Utility.ZERO) return;
                if (Enemy.Velocity.X < Utility.ZERO) Enemy.Position = new Vector2(other.Position.X + other.Bounds.Width + Utility.TWO, Enemy.Position.Y);
                if (Enemy.Velocity.X > Utility.ZERO) Enemy.Position = new Vector2(other.Position.X - Enemy.Bounds.Width - Utility.TWO, Enemy.Position.Y);

                Enemy.Velocity *= -Utility.ONE;
                other.Velocity *= -Utility.ONE;
            }
        }
 public EnemyFireballCollisionHandler(CollisionData collision)
 {
     if (collision.GameObjectA is IEnemy)
     {
         enemy = (IEnemy)collision.GameObjectA;
         fireball = (IProjectile)collision.GameObjectB;
     }
     else
     {
         enemy = (IEnemy)collision.GameObjectB;
         fireball = (IProjectile)collision.GameObjectA;
     }
 }
        public static void PlayerEnemyCollision(IMario player, IEnemy enemy)
        {
            if (player.CurrentState is DeadMarioState)
                return;

            Vector2 direction = GetCollisionDirection(player.Bounds, enemy.Bounds);
            player.Position += direction * GetPenetration(player.Bounds, enemy.Bounds, direction);

            enemy.CurrentState.Hit(player, direction);

            if (!(direction.Y < Utility.ZERO)) return;
            player.Velocity *= Vector2.UnitX;
            player.Velocity -= Vector2.UnitY * Utility.VELOCITY_SCALER;
        }
        public void Update(IEnemy enemyA)
        {
            this.enemyA = enemyA;
            foreach (IEnemy enemyB in enemies)
            {
                Rectangle objectA = enemyA.Collider;
                Rectangle objectB = enemyB.Collider;
                Rectangle overlap = Rectangle.Intersect(objectA, objectB);
                continueCheck = true;
                if (enemyB.IsDead == false)
                {
                    if (enemyA is Koopa)
                    {
                        Koopa koopa = (Koopa)enemyA;
                        if (koopa.iKoopa is KoopaSpin && !overlap.IsEmpty && (objectA.X != objectB.X || objectA.Y != objectB.Y))
                        {
                            enemyB.TakeDamage();
                            continueCheck = false;
                        }
                    }
                    if (continueCheck)
                    {
                        if (overlap.Width > overlap.Height)
                        {
                            if (objectA.Location.Y > objectB.Location.Y)
                            {
                                enemyA.Bump(0, overlap.Height / 2);
                            }
                            if (objectA.Location.Y < objectB.Location.Y)
                            {
                                enemyA.Bump(0, -overlap.Height / 2);
                            }

                        }
                        if (overlap.Width < overlap.Height)
                        {
                            if (objectA.Location.X > objectB.Location.X)
                            {
                                enemyA.Bump(overlap.Width / 2, 0);
                            }
                            if (objectA.Location.X < objectB.Location.X)
                            {
                                enemyA.Bump(-overlap.Width / 2, 0);
                            }
                        }
                    }
                }
            }
        }
        public EnemyPipeCollisionHandler(CollisionData collision)
        {
            this.collision = collision;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IEnemy)
            {
                enemy = (IEnemy)collision.GameObjectA;
            }
            else
            {
                enemy = (IEnemy)collision.GameObjectB;
                side = side.FlipSide();
            }
        }
        public EnemyElevatorCollisionHandler(CollisionData collision, IGameState gameState)
        {
            this.collision = collision;
            this.gameState = gameState;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IEnemy)
            {
                enemy = (IEnemy)collision.GameObjectA;
            }
            else
            {
                enemy = (IEnemy)collision.GameObjectB;
                side = side.FlipSide();
            }
        }
        public BattleScreen(IPlayer player, IEnemy enemy, GameBoard board)
        {
            this.InitializeComponent();
            this.Player = player;
            this.Enemy = enemy;
            this.board = board;

            this.PopulateCharacterCell(player);
            this.PopulateCharacterCell(enemy);
            this.DrawCharactersStatistic();

            this.Skill1.Content = player.Skills[0].Name;
            this.Skill2.Content = player.Skills[1].Name;
            this.Skill3.Content = player.Skills[2].Name;
            this.Skill4.Content = player.Skills[3].Name;
        }
        public MarioEnemyCollisionHandler(CollisionData collision)
        {
            this.collision = collision;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IMario)
            {
                mario = (IMario)collision.GameObjectA;
                enemy = (IEnemy)collision.GameObjectB;
            }
            else
            {
                mario = (IMario)collision.GameObjectB;
                enemy = (IEnemy)collision.GameObjectA;
                side = side.FlipSide();
            }
        }
	// 
	public SoldierCaptive( IEnemy theEnemy)
	{
		m_emSoldier = ENUM_Soldier.Captive;
		m_Captive = theEnemy;

		// 設定成像
		SetGameObject( theEnemy.GetGameObject() );

		// 將Enemy數值轉成Soldier用的
		SoldierAttr tempAttr = new SoldierAttr();
		tempAttr.SetSoldierAttr( theEnemy.GetCharacterAttr().GetBaseAttr() );
		tempAttr.SetAttStrategy( theEnemy.GetCharacterAttr().GetAttStrategy());
		tempAttr.SetSoldierLv( 1 );	// 設定為1級
		SetCharacterAttr( tempAttr );

		// 設定武器
		SetWeapon( theEnemy.GetWeapon() );

		// 更改為SoldierAI
		m_AI = new SoldierAI( this );
		m_AI.ChangeAIState( new IdleAIState() );
	}
Beispiel #18
0
 public override bool IsConditionFulfilled(IGameController controller, IEnemy enemy)
 {
     return(true);
 }
        public GoombaStompedState(IEnemy enemy)
            : base(enemy)
        {
            goomba = enemy;

        }
Beispiel #20
0
 public KoopaSprite(IEnemy enemy)
     : base(Utility.KoopaWalkingLeftFrames, Utility.KOOPA_SPRITESHEET_ROWS, Utility.KOOPA_SPRITESHEET_COLUMNS, texture)
 {
     this.enemy = enemy;
 }
Beispiel #21
0
 public ICommand EnemyEffect(IEnemy enemy)
 {
     return new EnemyStun(enemy);
 }
Beispiel #22
0
 public ISprite GetGoriyaThrowRight(IEnemy enemy)
 {
     return(new GoriyaThrowRight(enemy, enemyLinkSheet));
 }
Beispiel #23
0
 public ISprite GetAnimatedWallMaster(IEnemy enemy)
 {
     return(new AnimatedWallMaster(enemy, enemyLinkSheet));
 }
Beispiel #24
0
 // 增加Enemy
 public void AddEnemy(IEnemy theEnemy)
 {
     m_Enemys.Add(theEnemy);
 }
Beispiel #25
0
 // 移除Enemy
 public void RemoveEnemy(IEnemy theEnemy)
 {
     m_Enemys.Remove(theEnemy);
 }
Beispiel #26
0
 public static void EnemyHorizontalBounce(IEnemy enemy, IPipe pipe, Direction direction)
 {
     enemy.ChangeDirection();
     ResolveOverlap(enemy, pipe, direction);
 }
Beispiel #27
0
 public void Attack(IEnemy enemy)
 {
     enemy.BeFlipped();
     enemy.Movement = new DeadMovement(game);
     Boom();
 }
Beispiel #28
0
 public EnemyWallBlockDoorCollision(IEnemy enemy, in Rectangle otherThing)
Beispiel #29
0
 public EnemyLeftCommand(IEnemy gameObject)
 {
     enemy = gameObject;
 }
 public MarioAndKoopaCollisionResponse(ICollision collision)
 {
     this.firstEntity  = (IMario)collision.GetFirstEntity();
     this.secondEntity = (IEnemy)collision.GetSecondEntity();
     this.collision    = collision;
 }
Beispiel #31
0
 public ICommand EnemyEffect(IEnemy enemy)
 {
     Halt();
     _sprite.Hide();
     return(new SpawnableDamage(enemy, 1));
 }
Beispiel #32
0
 private void DrawImages(PictureBox pictureBox, IEnemy enemy, Image image, string id)
 {
     pictureBox.Image = image;
     pictureBox.Width = 140;
     pictureBox.Height = image.Height;
     pictureBox.BackColor = Color.Transparent;
     pictureBox.Left = enemy.Position.X;
     pictureBox.Top = enemy.Position.Y;
     pictureBox.Click += PictureBox_Click;
     pictureBox.Name = id;
     this.Controls.Add(pictureBox);
 }
Beispiel #33
0
 public ISprite GetGoriyaUp(IEnemy enemy)
 {
     return(new GoriyaUp(enemy, enemyLinkSheet));
 }
Beispiel #34
0
 public ISprite GetGelMovingHorizontal(IEnemy enemy)
 {
     return(new GelMovingHorizontal(enemy, enemyLinkSheet));
 }
Beispiel #35
0
 public ISprite GetBladeTrapSprites(IEnemy enemy)
 {
     return(new BladeTrapSprites(enemy, enemyLinkSheet));
 }
Beispiel #36
0
 /*Enemy Sprites*/
 public ISprite GetGelIdleJump(IEnemy enemy)
 {
     return(new GelIdleJump(enemy, enemyLinkSheet));
 }
Beispiel #37
0
 public ISprite GetAnimatedKeese(IEnemy enemy)
 {
     return(new AnimatedKeese(enemy, enemyLinkSheet));
 }
Beispiel #38
0
 public abstract void VisitorEnemy(IEnemy enemy);
Beispiel #39
0
 public ISprite GetGelMovingVertical(IEnemy enemy)
 {
     return(new GelMovingVertical(enemy, enemyLinkSheet));
 }
 public EStateGoriyaMovingLeft(IEnemy enemy, int coolDown = 0)
 {
     this.enemy    = enemy;
     this.sprite   = SpriteFactory.Instance.GetGoriyaMovingLeft(enemy);
     this.coolDown = coolDown;
 }
Beispiel #41
0
        /// <summary>
        /// When enemy dies, remove it from the enemy list. If that was the last enemy finish the wave.
        /// </summary>
        /// <param name="enemy">The enemy that was destroyed</param>
        void OnEnemyDestroyed(IEnemy enemy) {
            enemyList.Remove(enemy);

            if (IsLastEnemy()) {
                FinishWave();
            }
        }
Beispiel #42
0
 internal static void AddEnemy(IEnemy e)
 {
     if (_instance._currentMode != DisplayConstants.Modes.ActiveGameMode.ACTIVEGAMEMODE)
         return;
     getInstance()._display.AddEnemies(e.EnemyType.ToString(), e.Points, 1);
 }
Beispiel #43
0
 public void AddEnemy(IEnemy entity)
 {
     enemies.Add(entity);
 }
Beispiel #44
0
        private void StartFight(IEnemy questEnemy)
        {
            this.quest.QuestCompleted += this.hero.Collect;

            this.consoleWriter.WriteLine(string.Format(QuestGamePlayControllerConstants.EncounterEnemy, questEnemy.GetType().Name));

            int battleRound = InitialBattleRound;

            while (this.hero.Health > MinBeingHealth && questEnemy.Health > MinBeingHealth)
            {
                this.consoleWriter.WriteLine(QuestGamePlayControllerConstants.ChooseYourNextMove);
                this.consoleWriter.WriteLine(QuestGamePlayControllerConstants.NextMoveInBattle);

                char command = this.consoleReader.ReadKey();
                this.consoleWriter.Clear();

                this.consoleWriter.WriteLine(string.Format(QuestGamePlayControllerConstants.BattleRound, battleRound++));
                this.consoleWriter.Write(Environment.NewLine);

                switch (command)
                {
                case CommandFirstChoice:
                    this.Attack(questEnemy);
                    break;

                case CommandSecondChoice:
                    this.consoleWriter.WriteLine(this.hero.Heal());
                    this.hero.TakeDamage(questEnemy.GetAttackDamage());
                    break;

                case CommandThirdChoice:
                    this.UpdateStats();
                    this.consoleWriter.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.ResetColor();
                    return;

                default:
                    battleRound--;
                    Console.ForegroundColor = ConsoleColor.Red;
                    this.consoleWriter.WriteLine(QuestGamePlayControllerConstants.WrongCommand);
                    Console.ResetColor();
                    break;
                }

                this.UpdateStats();
                this.consoleWriter.Write(Environment.NewLine);
            }

            this.consoleWriter.Clear();

            if (this.hero.Health > MinBeingHealth)
            {
                this.quest.KilledEnemy(questEnemy);

                this.consoleWriter.WriteLine(string.Format(QuestGamePlayControllerConstants.CongratulationForKillingAnEnemy, this.hero.GetType().Name, questEnemy.GetType().Name));
                this.consoleWriter.Write(Environment.NewLine);

                this.quest.CompleteQuest();

                Console.ForegroundColor = ConsoleColor.Green;
                this.consoleWriter.WriteLine(this.quest.ShowRewards());
                this.consoleWriter.Write(Environment.NewLine);
                Console.ResetColor();

                this.UpdateStats();
            }
            else
            {
                this.consoleWriter.WriteLine(string.Format(QuestGamePlayControllerConstants.DiedMessage, questEnemy.GetType().Name));
                this.consoleWriter.GameOver();
            }
        }
Beispiel #45
0
 public virtual void CollideWithUnit(IEnemy Unit)
 {
 }
Beispiel #46
0
 public LinkOnEnemy(Link link, IEnemy enemy, Collision.Collision.Direction direction)
 {
     this.link      = link;
     this.enemy     = enemy;
     this.direction = direction;
 }
 public override void Hit(IEnemy other, Vector2 direction) { }
 public void Attack(IEnemy enemy)
 {
     enemy.TakeDamage();
     Boom();
 }
Beispiel #49
0
 public DownMovingGoriyaState(IEnemy goriya)
     : base(goriya)
 {
     enemy.Sprite = EnemySpriteFactory.Instance.CreateDownMovingGoriyaSprite();
     (enemy as Goriya).direction = "down";
 }
 public ICommand EnemyEffect(IEnemy enemy)
 {
     return(_partyTime ? (ICommand) new SpawnableDamage(enemy, 100) : NoOp.Instance);
 }
Beispiel #51
0
 private Image GetImage(IEnemy enemy)
 {
     switch (enemy.Picture)
     {
         case Pictures.Golem:
             return Properties.Resources.golem;
         case Pictures.Ork:
             return Properties.Resources.orc;
         case Pictures.Skeleton:
             return Properties.Resources.skeleton;
         case Pictures.Drake:
             return Properties.Resources.drake;
         case Pictures.Goblin:
             return Properties.Resources.goblin;
         case Pictures.Shade:
             return Properties.Resources.shade;
         default:
             //return Properties.Resources.golem;
             throw new NoPictureException();
     }
 }
Beispiel #52
0
 public ZolDarkGreenIdleState(IEnemy enemy)
 {
     this.enemy = enemy;
     this.enemy.Velocity.Magnitude = 0;
 }
 public EnemyAI(IEnemy enemy)
 {
     parent = enemy;
 }
Beispiel #54
0
 public void Use(IEnemy enemy)
 {
     enemy.Health -= Damage;
     enemy.Armor  -= ArmorDamage;
 }
Beispiel #55
0
	void Start () {
		if (transform.parent != null) me = (IEnemy) transform.parent.gameObject.GetComponent(typeof(IEnemy));
	}
Beispiel #56
0
 public void AddEnemy(IEnemy enemy)
 {
     mEnemys.Add(enemy);
 }
Beispiel #57
0
 public void DealDamage(IEnemy enemy)
 {
     this.attackBehaviour.DealDamage(enemy);
 }
Beispiel #58
0
 public void RemoveEnemy(IEnemy enemy)
 {
     mEnemys.Remove(enemy);
 }
Beispiel #59
0
 public void RemoveEntity(IEnemy entity)
 {
     enemies.Remove(entity);
 }
 public BasicProjectile(double x, double y, IEnemy target, int damage)
     : base(x, y, BasicProjectile.ProjectileSpeed, target, new ImageBrush(new CroppedBitmap(new BitmapImage(
                                                                                                new Uri(@"..\..\Resources\ProjectilesStyleOne.png", UriKind.Relative)), new Int32Rect(1293, 1317, 33, 29))), damage, new BasicDebuff())
 {
 }