Пример #1
0
        public static HeroCharacterObject CreateHeroCharacterObject(WeaponDefinition definition, int x, int y, Direction direction)
        {
            //IL_0067: Unknown result type (might be due to invalid IL or missing references)
            //IL_006c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0087: Unknown result type (might be due to invalid IL or missing references)
            //IL_0088: Unknown result type (might be due to invalid IL or missing references)
            if (null == s_instance)
            {
                Log.Error("CreateHeroCharacterObject called while the factory is not ready.", 175, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                return(null);
            }
            if (!FightMap.current.TryGetCellObject(x, y, out CellObject cellObject))
            {
                Log.Error(string.Format("{0} called with an invalid position {1}, {2}.", "CreateHeroCharacterObject", x, y), 184, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                return(null);
            }
            Transform transform = cellObject.get_transform();
            Vector3   position  = transform.get_position();

            position.y += 0.5f;
            HeroCharacterObject component = Object.Instantiate <GameObject>(s_instance.m_heroCharacterPrefab, position, Quaternion.get_identity(), transform).GetComponent <HeroCharacterObject>();

            component.InitializeDefinitionAndArea(definition, x, y);
            component.SetCellObject(cellObject);
            component.direction = direction;
            return(component);
        }
Пример #2
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out HeroStatus heroStatus))
            {
                if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus))
                {
                    WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                    if (null != weaponDefinition)
                    {
                        HeroCharacterObject heroCharacterObject = FightObjectFactory.CreateHeroCharacterObject(weaponDefinition, refCoord.X, refCoord.Y, (Direction)direction);
                        if (null != heroCharacterObject)
                        {
                            heroStatus.view = heroCharacterObject;
                            yield return(heroCharacterObject.LoadAnimationDefinitions(skinId, (Gender)gender));

                            heroCharacterObject.Initialize(fightStatus, ownerStatus, heroStatus);
                            UpdateAudioContext(ownerStatus, heroStatus.baseLife);
                            yield return(heroCharacterObject.Spawn());
                        }
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.PlayerNotFound(ownerId), 98, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <HeroStatus>(concernedEntity), 103, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }