Example #1
0
        public unsafe IEnumerator AddMonsterSpawnCell(int x, int y, Direction direction)
        {
            MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition;

            if (null == monsterSpawnCellDefinition)
            {
                yield break;
            }
            IMapDefinition mapDefinition = m_mapDefinition;
            Vector2        val           = Vector2Int.op_Implicit(mapDefinition.sizeMin);

            if ((float)x < ((IntPtr)(void *)val).x || (float)y < ((IntPtr)(void *)val).y)
            {
                yield break;
            }
            Vector2 val2 = Vector2Int.op_Implicit(mapDefinition.sizeMax);

            if ((float)x >= ((IntPtr)(void *)val2).x || (float)y >= ((IntPtr)(void *)val2).y)
            {
                yield break;
            }
            int        index      = mapDefinition.GetCellIndex(x, y);
            CellObject cellObject = m_cellObjectsByIndex[index];
            Transform  transform  = cellObject.get_transform();
            Vector3    position   = transform.get_position() + 0.5f * Vector3.get_up();
            Quaternion rotation   = Quaternion.get_identity();

            if (AudioManager.isReady)
            {
                AudioReference appearanceSound = monsterSpawnCellDefinition.appearanceSound;
                if (appearanceSound.get_isValid())
                {
                    AudioManager.PlayOneShot(appearanceSound, transform);
                }
            }
            VisualEffect appearanceEffect = monsterSpawnCellDefinition.appearanceEffect;

            if (null != appearanceEffect)
            {
                Object.Instantiate <VisualEffect>(appearanceEffect, position, rotation, transform);
                float appearanceDelay = monsterSpawnCellDefinition.appearanceDelay;
                if (appearanceDelay > 0f)
                {
                    yield return((object)new WaitForTime(appearanceDelay));
                }
            }
            GameObject val3 = monsterSpawnCellDefinition.Instantiate(position, rotation, cellObject.get_transform());

            if (!(null == val3))
            {
                val3.GetComponent <SpawnCellObject>().SetDirection(direction);
                m_monsterSpawnCellDictionary.Add(index, val3);
            }
        }
        public static IEnumerator PlayGenericEffect(SpellEffectKey key, int fightId, int?parentEventId, [NotNull] IsoObject target, [CanBeNull] FightContext fightContext)
        {
            if (s_spellEffectCache == null || s_currentSpellEffectOverrideData == null)
            {
                Log.Error("PlayGenericEffect called while the factory is not ready.", 290, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs");
            }
            else
            {
                if (((!parentEventId.HasValue || !s_currentSpellEffectOverrideData[fightId].TryGetSpellEffectOverride(key, parentEventId.Value, out SpellEffect value)) && !s_spellEffectCache.TryGetValue(key, out value)) || null == value)
                {
                    yield break;
                }
                CellObject cellObject = target.cellObject;
                if (null == cellObject)
                {
                    Log.Warning($"Tried to play generic effect {key} on target named {target.get_name()} ({((object)target).GetType().Name}) but the target is no longer on the board.", 313, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs");
                    yield break;
                }
                Transform  transform = cellObject.get_transform();
                Quaternion rotation  = Quaternion.get_identity();
                Vector3    scale     = Vector3.get_one();
                ITimelineContextProvider timelineContextProvider = target as ITimelineContextProvider;
                switch (value.orientationMethod)
                {
                case SpellEffect.OrientationMethod.None:
                {
                    CameraHandler current = CameraHandler.current;
                    if (null != current)
                    {
                        rotation = current.mapRotation.GetInverseRotation();
                    }
                    break;
                }

                case SpellEffect.OrientationMethod.Context:
                {
                    VisualEffectContext visualEffectContext;
                    if (timelineContextProvider != null && (visualEffectContext = (timelineContextProvider.GetTimelineContext() as VisualEffectContext)) != null)
                    {
                        visualEffectContext.GetVisualEffectTransformation(out rotation, out scale);
                    }
                    break;
                }

                case SpellEffect.OrientationMethod.SpellEffectTarget:
                    Log.Warning($"Spell effect named '{value.get_name()}' orientation method is {SpellEffect.OrientationMethod.SpellEffectTarget} but is not played from a spell.", 346, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs");
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                yield return(PlaySpellEffect(value, transform, rotation, scale, 0f, fightContext, timelineContextProvider));
            }
        }
        public static IEnumerator PlaySpellEffect([NotNull] SpellEffect spellEffect, [NotNull] IsoObject view, [NotNull] SpellEffectInstantiationData instantiationData, [NotNull] CastTargetContext castTargetContext)
        {
            CellObject cellObject = view.cellObject;

            if (null == cellObject)
            {
                Log.Warning("Tried to play spell effect " + spellEffect.get_name() + " on target named " + view.get_name() + " (" + ((object)view).GetType().Name + ") but the target is no longer on the board.", 449, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs");
                yield break;
            }
            Transform                transform = cellObject.get_transform();
            FightContext             context   = castTargetContext.fightStatus.context;
            ITimelineContextProvider timelineContextProvider = view as ITimelineContextProvider;
            Quaternion               rotation = Quaternion.get_identity();
            Vector3 scale = Vector3.get_one();

            switch (spellEffect.orientationMethod)
            {
            case SpellEffect.OrientationMethod.None:
            {
                CameraHandler current = CameraHandler.current;
                if (null != current)
                {
                    rotation = current.mapRotation.GetInverseRotation();
                }
                break;
            }

            case SpellEffect.OrientationMethod.Context:
            {
                VisualEffectContext visualEffectContext;
                if (timelineContextProvider != null && (visualEffectContext = (timelineContextProvider.GetTimelineContext() as VisualEffectContext)) != null)
                {
                    visualEffectContext.GetVisualEffectTransformation(out rotation, out scale);
                }
                break;
            }

            case SpellEffect.OrientationMethod.SpellEffectTarget:
                rotation = instantiationData.GetOrientation(cellObject.coords, castTargetContext);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            float delayOverDistance = instantiationData.GetDelayOverDistance(cellObject.coords);

            yield return(PlaySpellEffect(spellEffect, transform, rotation, scale, delayOverDistance, context, timelineContextProvider));
        }
        public void SetCursorPosition([NotNull] CellObject parent)
        {
            //IL_002f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0034: Unknown result type (might be due to invalid IL or missing references)
            //IL_0036: Unknown result type (might be due to invalid IL or missing references)
            //IL_003b: Unknown result type (might be due to invalid IL or missing references)
            //IL_004b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0050: Unknown result type (might be due to invalid IL or missing references)
            //IL_0055: Unknown result type (might be due to invalid IL or missing references)
            //IL_005a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0061: Unknown result type (might be due to invalid IL or missing references)
            //IL_0075: Unknown result type (might be due to invalid IL or missing references)
            //IL_007a: Unknown result type (might be due to invalid IL or missing references)
            //IL_007f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0080: Unknown result type (might be due to invalid IL or missing references)
            //IL_0081: Unknown result type (might be due to invalid IL or missing references)
            if (null == m_cursor)
            {
                return;
            }
            Transform transform  = parent.get_transform();
            Transform transform2 = m_cursor.get_transform();

            transform2.SetParent(transform, true);
            Quaternion inverseRotation = m_mapRotation.GetInverseRotation();
            Vector3    val             = transform.get_position() + inverseRotation * new Vector3(-0.01f, 0.51f, -0.01f);
            Quaternion val2            = m_mapRotation.GetInverseRotation() * Quaternion.Euler(90f, 0f, 0f);

            transform2.SetPositionAndRotation(val, val2);
            if (!m_displayPlayableCharactersHighlights)
            {
                return;
            }
            List <CellPointer> active = m_active;
            int count = active.Count;

            for (int i = 0; i < count; i++)
            {
                CellPointer cellPointer = active[i];
                if (!(null == cellPointer) && cellPointer.get_transform().get_parent() == transform)
                {
                    m_cursor.get_gameObject().SetActive(false);
                    return;
                }
            }
            m_cursor.get_gameObject().SetActive(true);
        }
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                IsoObject view = entityStatus.view;
                if (null != view)
                {
                    IObjectWithAction objectWithAction;
                    if ((objectWithAction = (view as IObjectWithAction)) != null)
                    {
                        objectWithAction.SetPhysicalDamageBoost(valueAfter);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithAction>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                    }
                    CellObject cellObject = view.cellObject;
                    if (null != cellObject)
                    {
                        if (valueAfter > valueBefore)
                        {
                            yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.PhysicalDamageGain, fightStatus.fightId, parentEventId, view, fightStatus.context));

                            ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Action, cellObject.get_transform());
                        }
                        else
                        {
                            yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.PhysicalDamageLoss, fightStatus.fightId, parentEventId, view, fightStatus.context));

                            ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Action, cellObject.get_transform());
                        }
                    }
                    else
                    {
                        Log.Warning("Tried to apply a damage modifier on target named " + view.get_name() + " (" + ((object)view).GetType().Name + ") but the target is no longer on the board.", 56, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 61, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 66, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
            }
        }
 private void OnFightMapTargetChanged(bool hasTarget, CellObject cellObject)
 {
     //IL_0036: Unknown result type (might be due to invalid IL or missing references)
     if (!(m_companionBeingCast == null))
     {
         CleanCastHighlight();
         if (hasTarget && cellObject != null)
         {
             DragNDropListener.instance.SnapDragToWorldPosition(CameraHandler.current.camera, cellObject.get_transform().get_position());
             m_companionBeingCast.OnEnterTarget();
             m_castHighlight = m_factory.CreateCastHighlight((ReserveCompanionStatus)m_companionBeingCast.value, cellObject.highlight.get_transform());
         }
         else
         {
             DragNDropListener.instance.CancelSnapDrag();
             m_companionBeingCast.OnExitTarget();
         }
     }
 }