Exemplo n.º 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;
 }
Exemplo n.º 3
0
 public override void Hit(IEnemy other, Vector2 direction)
 {
     if (other.CurrentState.CanHarmOtherEnemies() && CanHarmOtherEnemies())
         Enemy.Velocity *= -Utility.ONE;
     else
         other.Kill();
 }
Exemplo n.º 4
0
        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;
		}
Exemplo n.º 7
0
        public void ReportEnemyHit(IEnemy enemy, IShot shot)
        {
            enemy.SubtractHealth(shot.FirePower);

            // Todo: Ugly..
            if (enemy.IsBoss && enemy.Health <= 0)
            {
                this.IsBossEliminated = true;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 12
0
        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();
            }
        }
Exemplo n.º 15
0
        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();
            }
        }
Exemplo n.º 17
0
	// 
	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() );
	}
Exemplo n.º 18
0
 public override bool IsConditionFulfilled(IGameController controller, IEnemy enemy)
 {
     return(true);
 }
Exemplo n.º 19
0
        public GoombaStompedState(IEnemy enemy)
            : base(enemy)
        {
            goomba = enemy;

        }
Exemplo n.º 20
0
 public KoopaSprite(IEnemy enemy)
     : base(Utility.KoopaWalkingLeftFrames, Utility.KOOPA_SPRITESHEET_ROWS, Utility.KOOPA_SPRITESHEET_COLUMNS, texture)
 {
     this.enemy = enemy;
 }
Exemplo n.º 21
0
 public ICommand EnemyEffect(IEnemy enemy)
 {
     return new EnemyStun(enemy);
 }
Exemplo n.º 22
0
 public ISprite GetGoriyaThrowRight(IEnemy enemy)
 {
     return(new GoriyaThrowRight(enemy, enemyLinkSheet));
 }
Exemplo n.º 23
0
 public ISprite GetAnimatedWallMaster(IEnemy enemy)
 {
     return(new AnimatedWallMaster(enemy, enemyLinkSheet));
 }
Exemplo n.º 24
0
 // 增加Enemy
 public void AddEnemy(IEnemy theEnemy)
 {
     m_Enemys.Add(theEnemy);
 }
Exemplo n.º 25
0
 // 移除Enemy
 public void RemoveEnemy(IEnemy theEnemy)
 {
     m_Enemys.Remove(theEnemy);
 }
Exemplo n.º 26
0
 public static void EnemyHorizontalBounce(IEnemy enemy, IPipe pipe, Direction direction)
 {
     enemy.ChangeDirection();
     ResolveOverlap(enemy, pipe, direction);
 }
Exemplo n.º 27
0
 public void Attack(IEnemy enemy)
 {
     enemy.BeFlipped();
     enemy.Movement = new DeadMovement(game);
     Boom();
 }
Exemplo n.º 28
0
 public EnemyWallBlockDoorCollision(IEnemy enemy, in Rectangle otherThing)
Exemplo n.º 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;
 }
Exemplo n.º 31
0
 public ICommand EnemyEffect(IEnemy enemy)
 {
     Halt();
     _sprite.Hide();
     return(new SpawnableDamage(enemy, 1));
 }
Exemplo n.º 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);
 }
Exemplo n.º 33
0
 public ISprite GetGoriyaUp(IEnemy enemy)
 {
     return(new GoriyaUp(enemy, enemyLinkSheet));
 }
Exemplo n.º 34
0
 public ISprite GetGelMovingHorizontal(IEnemy enemy)
 {
     return(new GelMovingHorizontal(enemy, enemyLinkSheet));
 }
Exemplo n.º 35
0
 public ISprite GetBladeTrapSprites(IEnemy enemy)
 {
     return(new BladeTrapSprites(enemy, enemyLinkSheet));
 }
Exemplo n.º 36
0
 /*Enemy Sprites*/
 public ISprite GetGelIdleJump(IEnemy enemy)
 {
     return(new GelIdleJump(enemy, enemyLinkSheet));
 }
Exemplo n.º 37
0
 public ISprite GetAnimatedKeese(IEnemy enemy)
 {
     return(new AnimatedKeese(enemy, enemyLinkSheet));
 }
Exemplo n.º 38
0
 public abstract void VisitorEnemy(IEnemy enemy);
Exemplo n.º 39
0
 public ISprite GetGelMovingVertical(IEnemy enemy)
 {
     return(new GelMovingVertical(enemy, enemyLinkSheet));
 }
Exemplo n.º 40
0
 public EStateGoriyaMovingLeft(IEnemy enemy, int coolDown = 0)
 {
     this.enemy    = enemy;
     this.sprite   = SpriteFactory.Instance.GetGoriyaMovingLeft(enemy);
     this.coolDown = coolDown;
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 43
0
 public void AddEnemy(IEnemy entity)
 {
     enemies.Add(entity);
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 45
0
 public virtual void CollideWithUnit(IEnemy Unit)
 {
 }
Exemplo n.º 46
0
 public LinkOnEnemy(Link link, IEnemy enemy, Collision.Collision.Direction direction)
 {
     this.link      = link;
     this.enemy     = enemy;
     this.direction = direction;
 }
Exemplo n.º 47
0
 public override void Hit(IEnemy other, Vector2 direction) { }
Exemplo n.º 48
0
 public void Attack(IEnemy enemy)
 {
     enemy.TakeDamage();
     Boom();
 }
Exemplo n.º 49
0
 public DownMovingGoriyaState(IEnemy goriya)
     : base(goriya)
 {
     enemy.Sprite = EnemySpriteFactory.Instance.CreateDownMovingGoriyaSprite();
     (enemy as Goriya).direction = "down";
 }
Exemplo n.º 50
0
 public ICommand EnemyEffect(IEnemy enemy)
 {
     return(_partyTime ? (ICommand) new SpawnableDamage(enemy, 100) : NoOp.Instance);
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 52
0
 public ZolDarkGreenIdleState(IEnemy enemy)
 {
     this.enemy = enemy;
     this.enemy.Velocity.Magnitude = 0;
 }
Exemplo n.º 53
0
 public EnemyAI(IEnemy enemy)
 {
     parent = enemy;
 }
Exemplo n.º 54
0
 public void Use(IEnemy enemy)
 {
     enemy.Health -= Damage;
     enemy.Armor  -= ArmorDamage;
 }
Exemplo n.º 55
0
	void Start () {
		if (transform.parent != null) me = (IEnemy) transform.parent.gameObject.GetComponent(typeof(IEnemy));
	}
Exemplo n.º 56
0
 public void AddEnemy(IEnemy enemy)
 {
     mEnemys.Add(enemy);
 }
Exemplo n.º 57
0
Arquivo: Enemy.cs Projeto: Chando/TD
 public void DealDamage(IEnemy enemy)
 {
     this.attackBehaviour.DealDamage(enemy);
 }
Exemplo n.º 58
0
 public void RemoveEnemy(IEnemy enemy)
 {
     mEnemys.Remove(enemy);
 }
Exemplo n.º 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())
 {
 }