Пример #1
0
    void HandleLocalSkills()
    {
        if (localSkillComponent == null)
        {
            localSkillComponent = SkillComponent.GetLocalMovementComponent();
        }
        if (localSkillComponent != null)
        {
            foreach (SkillEnum skillEnum in input.Skills)
            {
                if (!localSkillComponent.HasSkill(skillEnum))
                {
                    continue;
                }
                switch (skillEnum)
                {
                case SkillEnum.Tower:
                    Debug.Log("Summon turret!");
                    SummonTurret();
                    break;

                default:
                    break;
                }
            }
        }
    }
        private static void SkillFuncChangeSkillCDImpl(ref SSkillFuncContext inContext, int changeType, int slotMask, int value)
        {
            PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj;

            if (inTargetObj)
            {
                SkillComponent skillControl = inTargetObj.get_handle().SkillControl;
                if (skillControl != null)
                {
                    SkillSlot skillSlot = null;
                    for (int i = 0; i < 10; i++)
                    {
                        if (((slotMask == 0 && i != 0 && i != 4 && i != 5 && i != 7) || (slotMask & 1 << i) > 0) && skillControl.TryGetSkillSlot((SkillSlotType)i, out skillSlot) && skillSlot != null)
                        {
                            if (changeType == 0)
                            {
                                skillSlot.ChangeSkillCD(value);
                            }
                            else
                            {
                                skillSlot.ChangeMaxCDRate(value);
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
    /// <summary>
    /// Sections
    /// </summary>
    private void OnShootStart()
    {
        DashFire.LogicSystem.EventChannelForGfx.Publish("ge_ex_skill", "ui", "GunWoman", true);

        // Notify
        TriggerImpl.StopAllAnim(this.gameObject);
        LogicSystem.NotifyGfxAnimationStart(gameObject);
        if (ControlMove)
        {
            LogicSystem.NotifyGfxMoveControlStart(gameObject);
        }

        // Weapon
        TriggerImpl.ChangeWeaponById(this.gameObject, WeaponId);
        TriggerImpl.ChangeWeaponById(this.gameObject, SubWeaponId);

        // Animation
        m_StartEndTs  = TriggerImpl.GetAnimTime(this.gameObject, ShootStartAnimInfo);
        m_HoldEndTs   = ShootHoldTime + m_StartEndTs;
        m_MissleEndTs = m_HoldEndTs + SkillDuration;
        SkillDuration = m_MissleEndTs + TriggerImpl.GetAnimTime(this.gameObject, ShootEndAnimInfo);

        TriggerImpl.PlayAnims(this.gameObject, ShootStartAnimInfo);
        DashFire.LogicSystem.EventChannelForGfx.Publish("ge_touch_dir", "ui", true);

        SkillComponent.ChangeNextSection();
    }
Пример #4
0
    /// <summary>
    /// Sections
    /// </summary>
    private void OnShootStart()
    {
        // Notify
        TriggerImpl.StopAllAnim(this.gameObject);
        LogicSystem.NotifyGfxAnimationStart(gameObject);
        if (ControlMove)
        {
            LogicSystem.NotifyGfxMoveControlStart(gameObject);
        }

        // Weapon
        TriggerImpl.ChangeWeaponById(this.gameObject, WeaponId);
        TriggerImpl.ChangeWeaponById(this.gameObject, SubWeaponId);

        // Animation
        TriggerImpl.PlayAnim(this.gameObject, ShootAnimInfo);
        SkillDuration = Mathf.Max(TriggerImpl.GetAnimTime(this.gameObject, ShootAnimInfo), SkillDuration);

        if (SupportRotateByHold)
        {
            DashFire.LogicSystem.EventChannelForGfx.Publish("ge_touch_dir", "ui", true);
        }
        if (SupportRotateByJoyStick)
        {
            TriggerImpl.ShowJoyStick(this.gameObject);
        }

        TriggerImpl.StartMoveById(this.gameObject, StartMovementId);

        SkillComponent.ChangeNextSection();
    }
Пример #5
0
    public override bool StartSkill(Vector3 targetPos)
    {
        ResetSkill();
        CDBeginTime = Time.time;
        Vector3 curTargetPos;

        if (UseCurTargetPos)
        {
            if (TriggerImpl.GetCurTargetPos(this.gameObject, out curTargetPos))
            {
                targetPos = curTargetPos;
            }
            else
            {
                return(StopSkill());
            }
        }
        if (UseFaceTargetPos || targetPos == Vector3.zero)
        {
            TargetPos = Script_Util.GetRoleFaceTargetPos(this.gameObject);
        }
        else
        {
            TargetPos = targetPos;
            AdjustTargetPos();
        }
        TriggerImpl.ResetTarget(this.gameObject);
        SkillComponent.ChangeSection((int)SkillSection.ShootStart);
        return(true);
    }
Пример #6
0
        public override void Process(Action _action, Track _track)
        {
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);

            if (actorHandle == 0)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
            }
            else
            {
                SkillComponent skillControl = actorHandle.handle.SkillControl;
                if (skillControl == null)
                {
                    if (ActionManager.Instance.isPrintLog)
                    {
                    }
                }
                else
                {
                    SkillSlot       slot;
                    SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                    if (((refParamObject != null) && skillControl.TryGetSkillSlot(refParamObject.SlotType, out slot)) && (slot != null))
                    {
                        slot.StartSkillCD();
                    }
                }
            }
        }
        public override void Leave(Action _action, Track _track)
        {
            base.Leave(_action, _track);
            this.targetActor = _action.GetActorHandle(this.targetId);
            if (!this.targetActor)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            this.skillControl = this.targetActor.handle.SkillControl;
            if (this.skillControl == null)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            SkillSlot skillSlot = null;

            if (!this.useSlotType)
            {
                this.StartSkillContextCD(_action, ref skillSlot);
            }
            else
            {
                this.StartSkillSlotCD(ref skillSlot);
            }
            if (skillSlot != null && this.bAbortReduce && _track.curTime <= base.End && !_track.Loop)
            {
                skillSlot.ChangeSkillCD(this.abortReduceTime);
            }
        }
 public override void OnUse()
 {
     base.OnUse();
     this.targetId = -1;
     this.targetActor.Release();
     this.skillControl = null;
 }
        public override void Process(Action _action, Track _track)
        {
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);

            if (!actorHandle)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            SkillComponent skillControl = actorHandle.get_handle().SkillControl;

            if (skillControl == null)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            SkillSlot       skillSlot;

            if (refParamObject != null && skillControl.TryGetSkillSlot(refParamObject.SlotType, out skillSlot) && skillSlot != null)
            {
                skillSlot.CurSkillEnergyCostTick();
            }
        }
Пример #10
0
        // permament features
        public override void InitializeConsole()
        {
            base.InitializeConsole();

            if (targetSkill == null)
            {
                return;
            }

            SkillComponent skillComp = targetSkill.Get <SkillComponent>();

            // draw skill name
            EGetScreenName getName    = (EGetScreenName)targetSkill.FireEvent(new EGetScreenName());
            string         screenName = getName.text;

            // draw the description of the skill
            DrawText(2, 1, screenName, Constants.COL_FRIENDLY);

            // common properties of skills: energy
            DrawText(2, 2, "E: " + skillComp.energy, Constants.COL_BLUE);
            PrintMessage(8, 2, "ATTR: %1" + skillComp.attribute, Constants.DEFAULT_COL_SET);

            // print the description as a dynamic text box
            var getSkillDescr = (EGetSkillDescription)targetSkill.FireEvent(new EGetSkillDescription());

            DrawTextBox(2, 4, console.getWidth() - 4, getSkillDescr.description);
        }
        private static void SkillFuncChangeSkillCDImpl(ref SSkillFuncContext inContext, int changeType, int slotMask, int value)
        {
            PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj;

            if (inTargetObj != 0)
            {
                SkillComponent skillControl = inTargetObj.handle.SkillControl;
                if (skillControl != null)
                {
                    SkillSlot slot = null;
                    for (int i = 0; i < 7; i++)
                    {
                        if (((((slotMask == 0) && (i != 0)) && ((i != 4) && (i != 5))) || ((slotMask & (((int)1) << i)) > 0)) && (skillControl.TryGetSkillSlot((SkillSlotType)i, out slot) && (slot != null)))
                        {
                            if (changeType == 0)
                            {
                                slot.ChangeSkillCD(value);
                            }
                            else
                            {
                                slot.ChangeMaxCDRate(value);
                            }
                        }
                    }
                }
            }
        }
        public override void Enter(Action _action, Track _track)
        {
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);

            if (!actorHandle)
            {
                return;
            }
            this.skillControl = actorHandle.handle.SkillControl;
            if (this.skillControl == null)
            {
                return;
            }
            if (this.skillControl.SkillUseCache != null)
            {
                if (this.cacheSkill)
                {
                    this.skillControl.SkillUseCache.SetCacheSkill(true);
                }
                if (this.cacheMove)
                {
                    this.skillControl.SkillUseCache.SetCacheMove(true);
                    DefaultGameEventParam defaultGameEventParam = new DefaultGameEventParam(actorHandle, actorHandle);
                    Singleton <GameEventSys> .instance.SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorClearMove, ref defaultGameEventParam);
                }
            }
        }
Пример #13
0
    public override void SetObject(IObject obj)
    {
        base.SetObject(obj);

        mAnimatorManager = mObj.GetComponent <AnimatorComponent>();
        if (mAnimatorManager == null)
        {
            mObj.AddComponent <AnimatorComponent>();
        }

        mSkillComponent = mObj.GetComponent <SkillComponent>();
        if (mSkillComponent == null)
        {
            mObj.AddComponent <SkillComponent>();
        }

        if (Obj == null)
        {
            return;
        }

        mAttackSpace = mObj.GetProperty("AttackSpace").GetFloat();

        // 获取怪物普攻技能
        mAttackId = mObj.GetProperty("AttackId").GetInt();

        mKey = string.Format("{0}_{1}", mObj.mObjId, mObj.mIndex);
    }
Пример #14
0
        public void Update(GameTime gameTime)
        {
            ComponentManager cm = ComponentManager.GetInstance();

            foreach (var entity in cm.GetComponentsOfType <SkillComponent>())
            {
                CooldownComponent cd             = cm.GetComponentForEntity <CooldownComponent>(entity.Key);
                SkillComponent    skillComponent = (SkillComponent)entity.Value;
                foreach (int entityUser in skillComponent.UsingEntities)
                {
                    if (cm.HasEntityComponent <EnergyComponent>(entityUser))
                    {
                        EnergyComponent energyComponent = cm.GetComponentForEntity <EnergyComponent>(entityUser);

                        if (skillComponent.EnergyCost < energyComponent.Current && cd.CooldownTimer <= 0)
                        {
                            skillComponent.Use(entityUser, 0);
                            energyComponent.Current -= skillComponent.EnergyCost;
                            cd.CooldownTimer         = cd.Cooldown;
                        }
                    }
                }
                skillComponent.UsingEntities.Clear();
            }
        }
Пример #15
0
 public MateEntity(IPlayerEntity owner, CharacterMateDto dto, NpcMonsterDto npcMonster) : base(VisualType.Monster, dto.Id)
 {
     Owner        = owner;
     Mate         = dto;
     NpcMonster   = npcMonster;
     Level        = dto.Level;
     LevelXp      = dto.Experience;
     Hp           = dto.Hp;
     HpMax        = dto.Hp;
     Mp           = dto.Mp;
     MpMax        = dto.Mp;
     IsTeamMember = dto.IsTeamMember;
     MateType     = dto.MateType;
     PetId        = 0;
     Movable      = new MovableComponent(this, NpcMonster.Speed)
     {
         Actual = new Position <short> {
             X = dto.MapX, Y = dto.MapY
         },
         Destination = new Position <short> {
             X = dto.MapX, Y = dto.MapY
         }
     };
     _visibility    = new VisibilityComponent(this);
     SkillComponent = new SkillComponent(this);
     Components     = new Dictionary <Type, IComponent>
     {
         { typeof(VisibilityComponent), _visibility },
         { typeof(MovableComponent), Movable },
         { typeof(SkillComponent), SkillComponent }
     };
 }
Пример #16
0
        public override void Enter(AGE.Action _action, Track _track)
        {
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);

            if (actorHandle == 0)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
            }
            else
            {
                this.skillControl = actorHandle.handle.SkillControl;
                if (this.skillControl == null)
                {
                    if (ActionManager.Instance.isPrintLog)
                    {
                    }
                }
                else
                {
                    this.SpawnBullet(_action);
                }
            }
        }
Пример #17
0
 public override void Process(Action _action, Track _track)
 {
     this.targetActor = _action.GetActorHandle(this.targetId);
     if (!this.targetActor)
     {
         if (ActionManager.Instance.isPrintLog)
         {
         }
         return;
     }
     this.skillControl = this.targetActor.handle.SkillControl;
     if (this.skillControl == null)
     {
         if (ActionManager.Instance.isPrintLog)
         {
         }
         return;
     }
     if (!this.useSlotType)
     {
         this.StartSkillContextCD(_action);
     }
     else
     {
         this.StartSkillSlotCD();
     }
 }
Пример #18
0
        private void UnpauseEntity(Entity entity)
        {
            TimeScaleComponent timeScaleComponent = entity.GetComponent <TimeScaleComponent>();
            AnimationComponent animationComponent = entity.GetComponent <AnimationComponent>();
            SkillComponent     skillComponent     = entity.GetComponent <SkillComponent>();

            Unpause(timeScaleComponent, animationComponent, skillComponent);
        }
Пример #19
0
 void Awake()
 {
     pv = GetComponent <PhotonView>();
     if (pv.isMine)
     {
         mySkill = this;
     }
 }
Пример #20
0
 private void UnlockSkill(SkillComponent skill)
 {
     Debug.Log("Unlocked Skill " + skill.config.skillName);
     unlockedSkills.Add(skill.config);
     GameEvents.current.DecreasecreaseXp(skill.config.xpCosts);
     GameEvents.current.DecreaseMoney(skill.config.moneyCosts);
     UpdateAggregatedStats();
 }
Пример #21
0
 public override bool StopSkill()
 {
     if (IsExecuting())
     {
         SkillComponent.ChangeSection((int)SkillSection.ShootEnd, true);
     }
     return(true);
 }
Пример #22
0
    private void AddPlayer()
    {
        playerID = Game.EntityManager.CreateEntity();

        var inputBlock = new ActionComponent();

        inputBlock.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, inputBlock);

        var form = new FormComponent();

        form.InitComponent(playerID, new Vector3(0, 50, 0), "Player", "");
        Game.EntityManager.AddComponent(playerID, form);

        var animComp = new AnimationComponent();

        animComp.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, animComp);

        var move = new MovementComponent();

        move.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, move);

        var crouch = new CrouchComponent();

        crouch.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, crouch);

        var run = new RunComponent();

        run.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, run);

        var jump = new JumpComponent();

        jump.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, jump);

        var skill = new SkillComponent();

        skill.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, skill);

        var health = new HealthComponent()
        {
            Damage = 0, DeathType = HealthComponent.DeathTypes.LifeEnded, HP_Max = 50
        };

        health.InitComponent(null);
        Game.EntityManager.AddComponent(playerID, health);

        var menuOptions = new MenuComponent();

        menuOptions.InitComponent(null);
        menuOptions.InitComponent(playerID, "Menu");
        Game.EntityManager.AddComponent(playerID, menuOptions);
    }
Пример #23
0
 public override void OnUse()
 {
     base.OnUse();
     this.bInit        = false;
     this.bStart       = false;
     this.lastTime     = 0;
     this.skillControl = null;
     this.targetActor.Release();
 }
Пример #24
0
 public override void ResetSkill()
 {
     m_AnimationCom    = gameObject.animation;
     SkillElapsed      = 0;
     IsCanBreak        = false;
     IsCanBreakBySkill = false;
     TargetPos         = Vector3.zero;
     SkillComponent.ChangeSection((int)SkillSection.None);
 }
Пример #25
0
 public bool TryToUnlockSkill(SkillComponent skill)
 {
     if (IsUnlockable(skill))
     {
         UnlockSkill(skill);
         return(true);
     }
     return(false);
 }
Пример #26
0
        public override void Process(Action _action, Track _track)
        {
            this.actor = _action.GetActorHandle(this.targetId);
            if (!this.actor)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            ActorRoot                 handle         = this.actor.get_handle();
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            PoolObjHandle <ActorRoot> originator     = refParamObject.Originator;
            int num = 0;

            if (originator && refParamObject != null)
            {
                SkillComponent skillControl = originator.get_handle().SkillControl;
                SkillSlot      skillSlot;
                if (skillControl.TryGetSkillSlot(refParamObject.SlotType, out skillSlot) && skillSlot != null)
                {
                    num = skillSlot.GetSkillLevel() - 1;
                }
            }
            if (num < 0)
            {
                num = 0;
            }
            if (this.type == SetCollisionTick.ColliderType.Box)
            {
                VCollisionBox collisionShape = SetCollisionTick.GetCollisionShape <VCollisionBox>(handle, CollisionShapeType.Box);
                collisionShape.Pos   = this.Pos;
                collisionShape.Size  = new VInt3(this.Size.x + this.SizeGrowthValue.x * num, this.Size.y + this.SizeGrowthValue.y * num, this.Size.z + this.SizeGrowthValue.z * num);
                collisionShape.dirty = true;
                collisionShape.ConditionalUpdateShape();
            }
            else if (this.type == SetCollisionTick.ColliderType.Sphere)
            {
                VCollisionSphere collisionShape2 = SetCollisionTick.GetCollisionShape <VCollisionSphere>(handle, CollisionShapeType.Sphere);
                collisionShape2.Pos    = this.Pos;
                collisionShape2.Radius = this.Radius + this.RadiusGrowthValue * num;
                collisionShape2.dirty  = true;
                collisionShape2.ConditionalUpdateShape();
            }
            else if (this.type == SetCollisionTick.ColliderType.CylinderSector)
            {
                VCollisionCylinderSector collisionShape3 = SetCollisionTick.GetCollisionShape <VCollisionCylinderSector>(handle, CollisionShapeType.CylinderSector);
                collisionShape3.Pos      = this.Pos;
                collisionShape3.Radius   = this.SectorRadius;
                collisionShape3.Height   = this.Height;
                collisionShape3.Degree   = this.Degree;
                collisionShape3.Rotation = this.Rotation;
                collisionShape3.dirty    = true;
                collisionShape3.ConditionalUpdateShape();
            }
        }
Пример #27
0
 private static void Unpause(TimeScaleComponent timeScaleComponent, AnimationComponent animationComponent,
                             SkillComponent skillComponent)
 {
     timeScaleComponent.Unpause();
     animationComponent.Animation.UnpauseAnimation();
     if (!timeScaleComponent.IsPaused)
     {
         skillComponent.Character.UnpauseForLockFrame();
     }
 }
Пример #28
0
        public PlayerEntity(ISession session, CharacterDto dto, IEnumerable <CharacterSkillDto> skills, IEnumerable <CharacterQuicklistDto> quicklist) : base(VisualType.Character, dto.Id)
        {
            Session   = session;
            Character = dto;
            Relations = new RelationList();
            Quicklist = new QuicklistComponent(this, quicklist);

            HpMax     = Algorithm.GetHpMax(dto.Class, dto.Level);
            Hp        = HpMax;
            MpMax     = Algorithm.GetMpMax(dto.Class, dto.Level);
            Mp        = MpMax;
            BasicArea = 1;
            Inventory = new InventoryComponent(this);
            Movable   = new MovableComponent(this)
            {
                Actual = new Position <short>
                {
                    X = dto.MapX,
                    Y = dto.MapY
                },
                Destination = new Position <short>
                {
                    X = dto.MapX,
                    Y = dto.MapY
                }
            };
            _visibility    = new VisibilityComponent(this);
            SkillComponent = new SkillComponent(this, skills);
            Locomotion     = new LocomotionComponent(this);
            Components     = new Dictionary <Type, IComponent>
            {
                { typeof(VisibilityComponent), _visibility },
                { typeof(InventoryComponent), Inventory },
                { typeof(SkillComponent), SkillComponent },
                { typeof(LocomotionComponent), Locomotion }
            };
            Mates = new List <IMateEntity>();

            #region Stat

            Defence              = (short)Algorithm.GetDefenceClose(Character.Class, Level);
            DefenceDodge         = (short)Algorithm.GetDodgeClose(Character.Class, Level);
            DistanceDefence      = (short)Algorithm.GetDefenceRange(Character.Class, Level);
            DistanceDefenceDodge = (short)Algorithm.GetDodgeRanged(Character.Class, Level);
            MagicalDefence       = (short)Algorithm.GetDefenceMagic(Character.Class, Level);
            MinHit                 = (short)Algorithm.GetMinHit(Character.Class, Level);
            MaxHit                 = (short)Algorithm.GetMaxHit(Character.Class, Level);
            HitRate                = (byte)Algorithm.GetHitRate(Character.Class, Level);
            CriticalChance         = Algorithm.GetHitCritical(Character.Class, Level);
            CriticalRate           = (byte)Algorithm.GetHitCriticalRate(Character.Class, Level);
            DistanceCriticalChance = Algorithm.GetDistCritical(Character.Class, Level);
            DistanceCriticalRate   = Algorithm.GetDistCriticalRate(Character.Class, Level);

            #endregion Stat
        }
Пример #29
0
 private void OnShooting()
 {
     if (IsSkillOver())
     {
         SkillComponent.ChangeNextSection();
     }
     else
     {
         SkillElapsed += Time.deltaTime;
     }
 }
Пример #30
0
        internal PlayerData(DbDataReader reader)
            : base(new Position(3093, 3244))
        {
            Id       = reader.ReadData <uint>("id");
            Username = reader.ReadData <string>("username");
            Password = reader.ReadData <string>("password");

            _equipmentComponent = new EquipmentComponent();
            _prayerComponent    = new PrayerComponent();
            _skillComponent     = new SkillComponent();
        }