public static UnitAbility GetUnitAbility(AbilitySetupSO abilitySetupSO)
    {
        List <ActionEffect> actionEffects = new List <ActionEffect>();

        foreach (var actionEffectData in abilitySetupSO.AbilityEffects)
        {
            actionEffects.Add(ActionEffectFactory.GetActionEffect(actionEffectData));
        }

        return(new UnitAbility(abilitySetupSO.AbilityName, abilitySetupSO.Independant, abilitySetupSO.TargetingType, abilitySetupSO.TargeterScaleSo.GetAbilityTargeterScale(abilitySetupSO.AbilitySize), actionEffects, abilitySetupSO.CommandQueue, abilitySetupSO.AffectedCharacters));
    }
Ejemplo n.º 2
0
        public override IEnumerable <IActionEffect> Execute()
        {
            Position activeActorPositionBefore    = Entity.position.Position;
            Position displacedActorPositionBefore = DisplacedEntity.position.Position;

            Entity.ReplacePosition(displacedActorPositionBefore);
            DisplacedEntity.ReplacePosition(activeActorPositionBefore);

            yield return(ActionEffectFactory.CreateMoveEffect(Entity, activeActorPositionBefore));

            yield return(ActionEffectFactory.CreateMoveEffect(Entity, displacedActorPositionBefore));
        }
Ejemplo n.º 3
0
        public override IEnumerable <IActionEffect> Execute()
        {
            GameEntity entityToRelease = Contexts.sharedInstance.game.GetEntityWithId(Entity.entityHolder.EntityHeld);

            Position?newPosition = _firstPlaceInAreaFinder.FindForItem(Entity.position.Position);

            entityToRelease.ReplacePosition(newPosition.Value);
            entityToRelease.AddEnergy(1f, 0f);
            entityToRelease.isCarryable = true;

            Entity.ReplaceEntityHolder(Guid.Empty);
            IActionEffect effect = ActionEffectFactory
                                   .CreateLambdaEffect(viewController => viewController.DropHeldEntity(entityToRelease), Entity.view.Controller);

            yield return(effect);
        }
Ejemplo n.º 4
0
        public override IEnumerable <IActionEffect> Execute()
        {
            Position previousPosition = Entity.position.Position;
            Position newPosition      = previousPosition + Direction;

            if (_grid.IsWalkable(newPosition))
            {
                IActionEffect effect = ActionEffectFactory.CreateMoveEffect(Entity, previousPosition);
                Entity.ReplacePosition(newPosition);
                yield return(effect);
            }
            else
            {
                IActionEffect effect = ActionEffectFactory.CreateBumpEffect(Entity, newPosition);
                yield return(effect);
            }
        }
Ejemplo n.º 5
0
        public override IEnumerable <IActionEffect> Execute()
        {
            if (Entity.entityHolder.EntityHeld != Guid.Empty || ItemToPickUp.hasHeld)
            {
                throw new InvalidOperationException(
                          "Actor should not try to pick up if he's holding an entity or someone else is holding an entity");
            }

            Entity.entityHolder.EntityHeld = ItemToPickUp.id.Id;
            ItemToPickUp.ReplaceHeld(Entity.id.Id);

            _uiFacade.AddLogEntry($"<color=#aaa>You pick up {ItemToPickUp.view.Controller.Name}.</color>");

            IActionEffect effect = ActionEffectFactory
                                   .CreateLambdaEffect(viewController => viewController.HoldOnFront(ItemToPickUp), Entity.view.Controller);

            yield return(effect);
        }
Ejemplo n.º 6
0
        public override IEnumerable <IActionEffect> Execute()
        {
            Entity.ReplaceEntityHolder(EntityToKidnap.id.Id);
            EntityToKidnap.AddHeld(Entity.id.Id);
            EntityToKidnap.RemoveEnergy();
            EntityToKidnap.isEnergyReady = false;
            EntityToKidnap.isCarryable   = false;

            if (!Entity.hasEntityHolder || Entity.entityHolder.EntityHeld == Guid.Empty)
            {
                IActionEffect effect = ActionEffectFactory
                                       .CreateLambdaEffect(viewController => viewController.HoldOnBack(EntityToKidnap), Entity.view.Controller);
                yield return(effect);
            }
            else
            {
                throw new InvalidOperationException("Kidnap action shouldn't be executed if the active actor is holding something.");
            }
        }
Ejemplo n.º 7
0
        public override IEnumerable <IActionEffect> Execute()
        {
            yield return(new ControlStaysEffect());

            List <Guid> inventoryList = Entity.inventory.EntitiesInInventory;

            Guid       itemToTakeId = inventoryList[_indexInInventory];
            GameEntity itemToTake   = Contexts.sharedInstance.game.GetEntityWithId(itemToTakeId);

            inventoryList[_indexInInventory] = Guid.Empty;
            Entity.ReplaceInventory(inventoryList);
            Entity.ReplaceEntityHolder(itemToTakeId);
            itemToTake.ReplacePosition(Entity.position.Position);

            IActionEffect effect = ActionEffectFactory
                                   .CreateLambdaEffect(viewController => viewController.HoldOnFront(itemToTake), Entity.view.Controller);

            yield return(effect);
        }
Ejemplo n.º 8
0
        public override IEnumerable <IActionEffect> Execute()
        {
            if (Entity.entityHolder.EntityHeld == _itemToDrop.id.Id)
            {
                IActionEffect dropEffect = ActionEffectFactory
                                           .CreateLambdaEffect(actorBehaviour => actorBehaviour.DropHeldEntity(_itemToDrop), Entity.view.Controller);

                Entity.ReplaceEntityHolder(Guid.Empty);

                string itemName = _itemToDrop.view.Controller.Name;

                Position?newPosition = _firstPlaceInAreaFinder.FindForItem(Entity.position.Position);
                _itemToDrop.RemoveHeld();
                _itemToDrop.ReplacePosition(newPosition ?? Entity.position.Position);
                _itemToDrop.view.Controller.RefreshWorldPosition();
                _uiFacade.AddLogEntry($"<color=#aaa>You drop {itemName} on the ground.</color>");

                yield return(dropEffect);
            }
        }
Ejemplo n.º 9
0
    void Awake()
    {
        PlatformType = PlatformType.Local;
#if (UNITY_ANDROID && !UNITY_EDITOR)
#if ANDROID_OPPO
        PlatformType = PlatformType.OPPO;
#elif ANDROID_UC
        PlatformType = PlatformType.UC;
#elif ANDROID_XIAOMI
        PlatformType = PlatformType.MI;
#elif ANDROID_TENCENT
        PlatformType = PlatformType.Tencent;
#endif
#endif
        TraceUtil.Log(PlatformType);
        Application.targetFrameRate = 60;

        m_instance = this;
        this.m_timedSendPackage = GetComponent <TimedSendPackage>();
        this.m_playerFactory    = GetComponent <PlayerFactory>();
        //this.m_monsterFactory = GetComponent<MonsterFactory>();
        this.m_damageFactory     = GetComponent <DamageFactory>();
        this.m_trapFactory       = GetComponent <TrapFactory>();
        this.m_portalFactory     = GetComponent <PortalFactory>();
        this.m_npcFactory        = GetComponent <NPCFactory>();
        this.m_SenceAudioFactory = GetComponent <SenceAudioFactory>();
        //this.m_bulletFactory = GetComponent<BulletFactory>();
        this.m_actionEffectFactory = GetComponent <ActionEffectFactory>();

        LoginManager.Instance.Init91();
        this.RegisterEventHandler();

        this.m_gameSettings = GetComponent <GameSettings>();

        //打印按钮Id
        TraceUtil.Log(SystemModel.Common, TaskBtnManager.Instance.GetBtnId());
    }
Ejemplo n.º 10
0
 void Awake()
 {
     m_instance = this;
 }