Esempio n. 1
0
        /// <summary>
        /// When enemy death we are send chat message to all player about this event if
        /// 1) enemy is orange NPC
        /// 2) i kill other player
        /// </summary>
        /// <param name="enemy">Enemy who was killed</param>
        public void OnEnemyDeath(NebulaObject enemy)
        {
            try {
                //log.InfoFormat(string.Format("PlayerCharacter:OnEnemyDeath()->{0}", enemy.Id));

                switch (enemy.getItemType())
                {
                case ItemType.Bot: {
                    BotObject botObject = enemy.GetComponent <BotObject>();
                    if (botObject != null)
                    {
                        switch (botObject.getSubType())
                        {
                        case BotItemSubType.Drill:
                        case BotItemSubType.Outpost:
                        case BotItemSubType.MainOutpost: {
                            mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                            break;
                        }

                        case BotItemSubType.StandardCombatNpc: {
                            ShipWeapon enemyWeapon = enemy.GetComponent <ShipWeapon>();
                            BotShip    enemyShip   = enemy.GetComponent <BotShip>();

                            if (enemyWeapon != null && enemyShip != null)
                            {
                                if (enemyWeapon.weaponDifficulty == Difficulty.boss || enemyWeapon.weaponDifficulty == Difficulty.boss2 ||
                                    enemyShip.difficulty == Difficulty.boss || enemyShip.difficulty == Difficulty.boss2)
                                {
                                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                                }
                            }
                        }
                        break;
                        }
                    }
                }
                break;

                case ItemType.Avatar: {
                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillOtherPlayerMessage(this, enemy));
                }
                break;
                }
            } catch (System.Exception exception) {
                log.InfoFormat("PlayerCharacter.OnEnemyDeath() exception: {0}", exception.Message);
                log.InfoFormat(exception.StackTrace);
            }
        }
Esempio n. 2
0
        public override void Start()
        {
            if (!m_StartCalled)
            {
                m_StartCalled = true;
                mWeapon       = RequireComponent <ShipWeapon>();
                player        = RequireComponent <MmoActor>();
                RequireComponent <PlayerSkills>();
                mAI        = RequireComponent <AIState>();
                mBonuses   = RequireComponent <PlayerBonuses>();
                mCharacter = RequireComponent <PlayerCharacterObject>();

                m_PassiveBonuses = GetComponent <PassiveBonusesComponent>();

                if (shipModel == null)
                {
                    SetModel(new ShipModel(resource));
                }

                m_ResistDetail.Reset();

                log.Info("PlayerShip.Start() completed");
            }
        }