Example #1
0
        /// <summary>
        /// attacked by enemy. Takes the damage action.
        /// </summary>
        /// <param name="attacker"></param>
        public override void ActionDamage(GameUnit attacker)
        {
            engageAction = Action.Damage;

            this.actionElapsedTime = 0.0f;
        }
Example #2
0
        /// <summary>
        /// when an item is picked up from the world, there will be HP recovery and 
        /// replenishment of ammunition.
        /// </summary>
        /// <param name="unit">item을 pick up한 unit</param>
        public void PickUp(GameUnit unit)
        {
            //  recovery life.
            unit.Life += 
                    (int)((float)unit.MaxLife * ((float)SpecData.RecoveryLife * 0.01f));

            if (unit.Life > unit.MaxLife)
                unit.Life = unit.MaxLife;

            //  the default weapon is must be machine gun.
            //  this is machine gun ammo.
            unit.DefaultWeapon.RemainAmmo += SpecData.RecoveryBullet;

            //  collision is off.
            this.Collide.RemoveInLayer();
            this.Enabled = false;
            this.Visible = false;

            //  must be no render and no update.
            this.RemoveFromParent();            
        }
Example #3
0
        /// <summary>
        /// attacked by enemy. takes the damage action.
        /// </summary>
        /// <param name="attacker"></param>
        public override void ActionDamage(GameUnit attacker)
        {
            switch (attacker.CurrentWeapon.WeaponType)
            {
                case WeaponType.PlayerHandgun:
                case WeaponType.PlayerMachineGun:
                case WeaponType.PlayerShotgun:
                case WeaponType.CameleerGun:
                case WeaponType.MaomingGun:
                    {
                        GameSound.Play3D(SoundTrack.HitGun, RobotGameGame.SinglePlayer);
                    }
                    break;
                case WeaponType.DuskmasCannon:
                case WeaponType.HammerCannon:
                case WeaponType.TigerCannon:
                    {
                        GameSound.Play3D(SoundTrack.HitCannon, 
                            RobotGameGame.SinglePlayer);
                    }
                    break;           
                case WeaponType.PhantomMelee:
                    {
                        GameSound.Play3D(SoundTrack.HitBossMelee, 
                            RobotGameGame.SinglePlayer);
                    }
                    break;
            }

            if (attacker.CurrentWeapon.SpecData.CriticalDamagedFire)
            {
                if (!isActiveBooster && !IsReloading && !IsWeaponChanging)
                {
                    this.prepareLowerAction = LowerAction.Damage;
                    this.prepareUpperAction = UpperAction.Damage;

                    this.isOverwriteLowerAction = true;
                    this.isOverwriteUpperAction = true;

                    if (GameSound.IsPlaying(soundRun))
                        GameSound.Stop(soundRun);

                    if (GameSound.IsPlaying(soundWalk))
                        GameSound.Stop(soundWalk);

                    CurrentWeapon.StopFireSound();
                }

                //  Trembling the camera
                if (FrameworkCore.CurrentCamera.FirstCamera is FollowCamera)
                {
                    InputComponent input = 
                        FrameworkCore.InputManager.GetInputComponent(this.PlayerIndex);

                    input.SetGamePadVibration(this.specData.CriticalDamagedTime / 2, 
                                              0.4f, 0.4f);
                }
           }
        }
Example #4
0
        /// <summary>
        /// attacked by enemy. When HP is 0, it gets destroyed.
        /// </summary>
        /// <param name="attacker"></param>
        public override void ActionHit(GameUnit attacker)
        {
            if (IsDead) return;

            if (attacker.CurrentWeapon == null)
                throw new InvalidOperationException("The harmer no have weapon");

            GameWeaponSpec AttackerWeaponSpec = attacker.CurrentWeapon.SpecData;

            //  Superman mode (DEBUG)
            if (RobotGameGame.SinglePlayer.Mode == GamePlayer.DebugMode.Superman ||
                RobotGameGame.SinglePlayer.Mode == GamePlayer.DebugMode.God)
            {
                Life = 0;  // If player is superman mode, This enemy must be die ^^
            }
            else
            {
                //  Reduce our player's life point by harmer's weapon power
                Life -= AttackerWeaponSpec.Damage;
                if (Life < 0) Life = 0;
            }

            if (Life == 0)
            {
                //  boss is dead
                ActionDead(attacker.WorldTransform.Translation);
            }
        }
Example #5
0
        /// <summary>
        /// attacked by enemy. when HP is 0, gets destoryed.
        /// </summary>
        /// <param name="attacker"></param>
        public override void ActionHit(GameUnit attacker)
        {
            if (IsDead) return;

            if (attacker.CurrentWeapon == null)
                throw new InvalidOperationException("The harmer no have weapon");

            GameWeaponSpec AttackerWeaponSpec = attacker.CurrentWeapon.SpecData;

            //  NeverDie mode (DEBUG)
            if (this.debugMode == DebugMode.NeverDie || this.debugMode == DebugMode.God)
            {
                Life = SpecData.Life;
            }            
            else
            {
                //  Reduce our player's life point by harmer's weapon power
                Life -= AttackerWeaponSpec.Damage;
                if (Life < 0) Life = 0;
            }

            if (Life == 0)
            {
                //  Our player is dead
                ActionDead(attacker.WorldTransform.Translation);

                BoosterParticleStop();
            }
            else
            {
                ActionDamage(attacker);
            }
        }
Example #6
0
 public virtual void ActionDamage(GameUnit attacker) { }
Example #7
0
 public virtual void ActionHit(GameUnit attacker) { }
Example #8
0
 /// <summary>
 /// plays back the 3D positional sound
 /// </summary>
 /// <param name="index">an index of game sound</param>
 /// <param name="owner">
 /// the object to which the 3D position will be applied.
 /// </param>
 /// <returns></returns>
 public static Cue Play3D(SoundTrack index, GameUnit owner)
 {
     return FrameworkCore.SoundManager.PlaySound3D(szSoundName[(int)index], 
                                                   owner.Emitter);
 }
Example #9
0
 /// <summary>
 /// plays back the 3D positional sound
 /// </summary>
 /// <param name="index">an index of game sound</param>
 /// <param name="owner">
 /// the object to which the 3D position will be applied.
 /// </param>
 /// <returns></returns>
 public static Cue Play3D(SoundTrack index, GameUnit owner)
 {
     return(FrameworkCore.SoundManager.PlaySound3D(szSoundName[(int)index],
                                                   owner.Emitter));
 }