Exemplo n.º 1
0
        public void Load()
        {
            if (!m_Loaded)
            {
                m_Loaded = true;
                Start();
                log.InfoFormat("PlayerShip LOad() [dy]");
                var workshop = (Workshop)GetComponent <CharacterObject>().workshop;
                var dropMgr  = DropManager.Get(nebulaObject.world.Resource());


                //ShipModelDocument document = GameApplication.Instance.Load(player.nebulaObject.Id, mCharacter.characterId, DatabaseDocumentType.ShipModel) as ShipModelDocument;

                var  app   = nebulaObject.mmoWorld().application;
                bool isNew = false;

                if (mCharacter == null)
                {
                    mCharacter = GetComponent <PlayerCharacterObject>();
                }
                if (string.IsNullOrEmpty(mCharacter.characterId))
                {
                    mCharacter.SetCharacterId((string)nebulaObject.Tag((byte)PlayerTags.CharacterId));
                }
                var dbModel = ShipModelDatabase.instance(app).LoadShipModel(mCharacter.characterId, resource as Res, out isNew);

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

                if (isNew)
                {
                    GenerateNewShipModel(dropMgr);
                    ShipModelDatabase.instance(app).SaveShipModel(mCharacter.characterId, shipModel);
                }
                else
                {
                    shipModel.Replace(dbModel);
                }

                shipModel.Update();
                GetComponent <MmoActor>().EventOnShipModelUpdated();
                log.Info("PlayerShip.Load() completed");
            }
        }
Exemplo 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");
            }
        }