public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.TryGetCompanion(companionDefId, out ReserveCompanionStatus companionStatus))
         {
             if (FightLogicExecutor.GetFightStatus(toFightId).TryGetEntity(toPlayerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     yield return(view.AddAdditionalCompanion(entityStatus, companionDefId, companionStatus.level));
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(toPlayerId, toFightId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
             }
         }
         else
         {
             Log.Error(FightEventErrors.ReserveCompanionNotFound(companionDefId, concernedEntity), 67, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
     }
 }
Exemplo n.º 2
0
        public IEnumerator Initialize()
        {
            CameraHandler.AddMapRotationListener(OnMapRotationChanged);
            FightStatus local       = FightStatus.local;
            int         regionCount = m_mapDefinition.regionCount;

            m_movementContexts = new FightMapMovementContext[regionCount];
            for (int i = 0; i < regionCount; i++)
            {
                FightStatus fightStatus = FightLogicExecutor.GetFightStatus(i);
                fightStatus.EntitiesChanged += OnEntitiesChanged;
                FightMapMovementContext fightMapMovementContext = new FightMapMovementContext(fightStatus.mapStatus, fightStatus);
                if (fightStatus == local)
                {
                    m_localMovementContext = fightMapMovementContext;
                }
                m_movementContexts[i] = fightMapMovementContext;
            }
            if (m_localMovementContext != null)
            {
                IMapStateProvider stateProvider = m_localMovementContext.stateProvider;
                m_targetContext = new FightMapTargetContext(stateProvider);
            }
            BoxCollider mapCollider = CreateCollider();

            InitializeHandlers(mapCollider, giveUserControl: false);
            MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition;

            if (null != monsterSpawnCellDefinition)
            {
                yield return(monsterSpawnCellDefinition.Initialize());

                m_monsterSpawnCellDictionary = new Dictionary <int, GameObject>();
            }
            if (AudioManager.isReady)
            {
                m_audioContext.Initialize();
                m_worldMusicRequest = AudioManager.LoadWorldMusic(m_musicGroup, m_ambianceGroup, m_audioContext);
                while (m_worldMusicRequest.state == AudioWorldMusicRequest.State.Loading)
                {
                    yield return(null);
                }
            }
        }
Exemplo n.º 3
0
        public void Release()
        {
            CameraHandler.RemoveMapRotationListener(OnMapRotationChanged);
            if (FightLogicExecutor.isValid)
            {
                int regionCount = m_mapDefinition.regionCount;
                for (int i = 0; i < regionCount; i++)
                {
                    FightStatus fightStatus = FightLogicExecutor.GetFightStatus(i);
                    if (fightStatus != null)
                    {
                        fightStatus.EntitiesChanged -= OnEntitiesChanged;
                    }
                }
            }
            MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition;

            if (null != monsterSpawnCellDefinition)
            {
                foreach (GameObject value in m_monsterSpawnCellDictionary.Values)
                {
                    monsterSpawnCellDefinition.DestroyInstance(value);
                }
                m_monsterSpawnCellDictionary.Clear();
                m_monsterSpawnCellDictionary = null;
                monsterSpawnCellDefinition.Release();
            }
            if (AudioManager.isReady)
            {
                m_audioContext.Release();
            }
            m_worldMusicRequest     = null;
            m_movementContexts      = null;
            m_localMovementContext  = null;
            m_activeMovementContext = null;
            m_targetContext         = null;
        }