protected virtual void OnWallJump(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (hActorData.m_hRigid == null || hActorData.m_hStatus == null ||
                hActorData.m_hInputData.m_fHorizontal == 0 || !FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.IsWalling) ||
                FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.WallJumping) ||
                !lstBehaviourData.TryGetDataRW(out WallJumpCacheData hData))
            {
                return;
            }


            Vector2 vForce = m_vJumpForce;

            if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.FacingRight))
            {
                vForce.x = -vForce.x;
            }

            hActorData.m_hRigid.velocity = Vector2.zero;

            hActorData.m_hRigid.AddForce(vForce);

            hActorData.m_fJumpStartTime = Time.time;
            hActorData.m_eStateFlag    |= ActorStateFlag.Jumping;
            hActorData.m_eStateFlag    |= ActorStateFlag.HoldingJump;
            hActorData.m_eStateFlag    |= ActorStateFlag.WallJumping;
            hData.m_fWallJumpLastTime   = Time.time;

            if (hActorData.m_hAnimation)
            {
                hActorData.m_hAnimation.m_hSpineAnimationState.SetAnimation(0, hActorData.m_hAnimation.m_sClimbAnimation, false);
                hActorData.m_hAnimation.m_hSpineAnimationState.AddAnimation(0, hActorData.m_hAnimation.m_sJumpingAnimation, true, 0.3f);
            }
        }
Example #2
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(EventConditionData hData)
        {
            var hPlayer = Global_GameplayManager.playerController;

            if (hPlayer == null || hPlayer.actorData.m_hRigid == null)
            {
                return(false);
            }

            var vVel = hPlayer.actorData.m_hRigid.velocity;

            if (FlagUtility.HasFlagUnsafe(m_eYType, VelocityYType.Zero) && vVel.y == m_fCheckY)
            {
                return(true);
            }

            if (FlagUtility.HasFlagUnsafe(m_eYType, VelocityYType.Up) && vVel.y > m_fCheckY)
            {
                return(true);
            }

            if (FlagUtility.HasFlagUnsafe(m_eYType, VelocityYType.Down) && vVel.y < m_fCheckY)
            {
                return(true);
            }


            return(false);
        }
Example #3
0
#pragma warning restore 0649
        #endregion

        #endregion

        #region Base - Override

        public override void OnStart(List <IDialogueEventData> lstData)
        {
            base.OnStart(lstData);

            if (!lstData.TryGetData(out DialogueEventData_MonoBehaviour <DSC_Dialogue_TypingController> hOutTyping))
            {
                return;
            }

            var hTyping = hOutTyping.m_hMono;

            if (FlagUtility.HasFlagUnsafe(m_eSetType, TypingSetType.TypingDelayTime))
            {
                hTyping.typingDelayTime = m_fTypingDelayTime;
            }

            if (FlagUtility.HasFlagUnsafe(m_eSetType, TypingSetType.TypingSound))
            {
                hTyping.typingSound = m_hTypingSound;
            }

            if (FlagUtility.HasFlagUnsafe(m_eSetType, TypingSetType.EndEventDelayTime))
            {
                hTyping.endEventDelayTime = m_fEndEventDelayTime;
            }
        }
        public override void OnUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnUpdateBehaviour(hActorData, lstBehaviourData);

            if (hActorData.m_hRigid == null || hActorData.m_hStatus == null)
            {
                return;
            }

            float fHorizontal = hActorData.m_hInputData.m_fHorizontal;

            if (fHorizontal == 0)
            {
                if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.Walking))
                {
                    return;
                }

                hActorData.m_eStateFlag &= ~ActorStateFlag.Walking;
            }
            else if (FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.IsWalling))
            {
                return;
            }
            else if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.Walking))
            {
                hActorData.m_eStateFlag |= ActorStateFlag.Walking;
            }

            float   fMoveSpeed = hActorData.m_hStatus.status.m_fMoveSpeed;
            Vector2 vVelocity  = hActorData.m_hRigid.velocity;

            vVelocity.x = hActorData.m_hInputData.m_fHorizontal * fMoveSpeed;
            hActorData.m_hRigid.velocity = vVelocity;
        }
Example #5
0
        protected virtual void OnJump(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (hActorData.m_hRigid == null || hActorData.m_hStatus == null ||
                !FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.CanDoubleJump) ||
                FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.WallJumping))
            {
                return;
            }

            var vVel = hActorData.m_hRigid.velocity;

            vVel.y = 0;
            hActorData.m_hRigid.velocity = vVel;
            hActorData.m_hRigid.AddForce(new Vector2(0, hActorData.m_hStatus.status.m_fDoubleJumpForce));

            hActorData.m_fJumpStartTime = Time.time;

            hActorData.m_eStateFlag |= ActorStateFlag.Jumping;
            hActorData.m_eStateFlag |= ActorStateFlag.HoldingJump;
            hActorData.m_eStateFlag &= ~ActorStateFlag.CanDoubleJump;

            if (hActorData.m_hAnimation != null)
            {
                hActorData.m_hAnimation.m_hSpineAnimationState.SetAnimation(0, hActorData.m_hAnimation.m_sJumpStartAnimation, false);
                hActorData.m_hAnimation.m_hSpineAnimationState.AddAnimation(0, hActorData.m_hAnimation.m_sJumpingAnimation, true, 0.2f);
                hActorData.m_eCurrentAnimation = ActorAnimation.Airing;
            }
        }
Example #6
0
        protected override void SetHoldingInputData(InputEventType eEventType, GetInputType eGetType)
        {
            if (actorData == null)
            {
                return;
            }

            var hInputData = m_hActorData.m_hInputData;

            InputEventType eHoldingInput = hInputData.m_eHoldingInput;

            if (eGetType == GetInputType.Down)
            {
                if (!FlagUtility.HasFlagUnsafe(eHoldingInput, eEventType))
                {
                    eHoldingInput |= eEventType;
                }
            }
            else if (eGetType == GetInputType.HoldEnd || eGetType == GetInputType.Up)
            {
                if (FlagUtility.HasFlagUnsafe(eHoldingInput, eEventType))
                {
                    eHoldingInput &= ~eEventType;
                }
            }

            hInputData.m_eHoldingInput = eHoldingInput;
            m_hActorData.m_hInputData  = hInputData;
        }
Example #7
0
#pragma warning restore 0649
        #endregion

        #endregion

        #region Base - Override

        public override void OnStart(List <IDialogueEventData> lstData)
        {
            base.OnStart(lstData);

            var hGroupController = GetImageGroupController(lstData);

            if (hGroupController == null)
            {
                return;
            }

            if (FlagUtility.HasFlagUnsafe(m_eType, ImageSetType.SetSprite))
            {
                SetSprite(hGroupController);
            }

            if (FlagUtility.HasFlagUnsafe(m_eType, ImageSetType.SetPosition))
            {
                SetPosition(hGroupController);
            }

            if (FlagUtility.HasFlagUnsafe(m_eType, ImageSetType.SetSize))
            {
                SetSize(hGroupController);
            }

            if (FlagUtility.HasFlagUnsafe(m_eType, ImageSetType.SetRotation))
            {
                SetRotation(hGroupController);
            }
        }
 private void Start()
 {
     if (FlagUtility.HasFlagUnsafe(Global_GameplayManager.playerSkill, m_eSkill))
     {
         GetSkill();
     }
 }
Example #9
0
        public override void RunEvent(BaseActorController hBaseController, BaseActorBehaviour hBaseBehaviour)
        {
            var hInput = hBaseController.baseActorInput;

            if (hInput == null || !hBaseController.TryGetActorData(out ActorData hActorData))
            {
                return;
            }


            float fHorizontal = hInput.inputData.m_fHorizontal;

            if (fHorizontal == 0)
            {
                if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.Walking))
                {
                    return;
                }

                hActorData.m_eStateFlag &= ~ActorStateFlag.Walking;
            }
            else if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.Walking))
            {
                hActorData.m_eStateFlag |= ActorStateFlag.Walking;
            }
        }
Example #10
0
        public virtual void Flip()
        {
            Quaternion qRightRot;
            Quaternion qLeftRot;

            if (m_bDefaultRightFacing)
            {
                qLeftRot  = Quaternion.Euler(0, 180, 0);
                qRightRot = Quaternion.Euler(0, 0, 0);
            }
            else
            {
                qLeftRot  = Quaternion.Euler(0, 0, 0);
                qRightRot = Quaternion.Euler(0, 180, 0);
            }

            if (FlagUtility.HasFlagUnsafe(m_hData.m_eStateFlag, ActorStateFlag.FacingRight))
            {
                transform.localRotation = qLeftRot;
                m_hData.m_eStateFlag   &= ~ActorStateFlag.FacingRight;
            }
            else
            {
                transform.localRotation = qRightRot;
                m_hData.m_eStateFlag   |= ActorStateFlag.FacingRight;
            }
        }
        protected override void OnUpdate()
        {
            Entities.ForEach((ref DSC_ADD_MoveSpeed3D hSpeed
                              , ref DSC_ADD_Run hRun
                              , in DSC_ADD_Input hInput) =>
            {
                switch (hRun.m_eInputType)
                {
                case GetInputType.Down:
                    if (FlagUtility.HasFlagUnsafe(hInput.m_eButtonDown, hRun.m_eButton))
                    {
                        hRun.m_bRunning = !hRun.m_bRunning;
                    }
                    break;

                case GetInputType.Hold:
                    hRun.m_bRunning = FlagUtility.HasFlagUnsafe(hInput.m_eButtonHold, hRun.m_eButton);
                    break;

                case GetInputType.Up:
                    if (FlagUtility.HasFlagUnsafe(hInput.m_eButtonUp, hRun.m_eButton))
                    {
                        hRun.m_bRunning = !hRun.m_bRunning;
                    }
                    break;
                }

                if (hRun.m_bRunning)
                {
                    hSpeed.m_fCurrentSpeed *= hRun.m_fSpeedMultiplier;
                }
            }).ScheduleParallel();
        }
Example #12
0
        public void DoDamage(int nDamage, GameObject hAttacker)
        {
            if (FlagUtility.HasFlagUnsafe(m_hActorController.actorData.m_eStateFlag, ActorStateFlag.IsDamage))
            {
                return;
            }

            DoDamage(nDamage);
        }
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (!PassAllCondition(hActorData, lstBehaviourData))
            {
                return(false);
            }

            return(m_bIsTrue == FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.IsGrounding));
        }
Example #14
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (!PassAllCondition(hActorData, lstBehaviourData))
            {
                return(false);
            }

            return(m_bIsHolding == FlagUtility.HasFlagUnsafe(hActorData.m_hInputData.m_eHoldingInput, m_eInput));
        }
Example #15
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetActorData(out ActorData hActorData) ||
                !PassAllCondition(hBaseController))
            {
                return(false);
            }

            return(m_bIsLock == FlagUtility.HasFlagUnsafe(hActorData.m_eLockFlag, m_eLockFlag));
        }
Example #16
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(EventConditionData hData)
        {
            var hPlayer = Global_GameplayManager.playerController;

            if (hPlayer == null)
            {
                return(false);
            }

            return(isTrue == FlagUtility.HasFlagUnsafe(hPlayer.actorData.m_eStateFlag, ActorStateFlag.GroundPounding));
        }
Example #17
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override bool PassCondition(BaseActorController hBaseController)
        {
            var hInput = hBaseController.baseActorInput;

            if (hInput == null || !PassAllCondition(hBaseController))
            {
                return(false);
            }

            return(m_bHolding == FlagUtility.HasFlagUnsafe(hInput.inputData.m_eHoldingInput, m_eInput));
        }
Example #18
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override void OnUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnUpdateBehaviour(hActorData, lstBehaviourData);

            if ((hActorData.m_hInputData.m_fHorizontal > 0 && !FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.FacingRight)) ||
                (hActorData.m_hInputData.m_fHorizontal < 0 && FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.FacingRight)))
            {
                var hController = (DSC_ActorController)hActorData.m_hController;
                hController.Flip();
            }
        }
#pragma warning restore 0649
        #endregion

        #region Variable - Property

        #endregion

        #endregion

        #region Base - Override

        public override void OnUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnUpdateBehaviour(hActorData, lstBehaviourData);

            var hPlayer = Global_GameplayManager.playerController;

            if (hPlayer == null)
            {
                return;
            }

            Vector2 vPlayerPos = hPlayer.actorData.m_hActor.position;
            Vector2 vOwnPos    = hActorData.m_hActor.position;

            if (FlagUtility.HasFlagUnsafe(m_eSearhType, SearchType.X))
            {
                if (vPlayerPos.x > vOwnPos.x && !FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.FacingRight) ||
                    vPlayerPos.x < vOwnPos.x && FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.FacingRight))
                {
                    goto NotFound;
                }

                float fDistanceX = Mathf.Abs(vPlayerPos.x - vOwnPos.x);
                if (fDistanceX > m_fSightXRange)
                {
                    goto NotFound;
                }
            }

            if (FlagUtility.HasFlagUnsafe(m_eSearhType, SearchType.Y))
            {
                float fDistanceY = Mathf.Abs(vPlayerPos.y - vOwnPos.y);
                if (fDistanceY > m_fSightYRange)
                {
                    goto NotFound;
                }
            }

            if (FlagUtility.HasFlagUnsafe(m_eSearhType, SearchType.Angle))
            {
                if (Vector2.Angle(vOwnPos, vPlayerPos) > m_fSightAngle)
                {
                    goto NotFound;
                }
            }

            FoundPlayer(hActorData, lstBehaviourData);
            return;

NotFound:
            NotFoundPlayer(hActorData, lstBehaviourData);
            ;
        }
        protected virtual void OnGravityIncrease(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (hActorData.m_hRigid == null || FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.HoldingJump))
            {
                return;
            }

            Vector2 vVelocity = hActorData.m_hRigid.velocity;

            vVelocity.y += Physics2D.gravity.y * hActorData.m_hRigid.gravityScale * m_fGravityMultiplier * Time.deltaTime;
            hActorData.m_hRigid.velocity = vVelocity;
        }
Example #21
0
        public override void OnFixedUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnFixedUpdateBehaviour(hActorData, lstBehaviourData);

            if (hActorData.m_hRigid)
            {
                if (FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.GroundPoundCasting))
                {
                    hActorData.m_hRigid.velocity = Vector2.zero;
                }
            }
        }
Example #22
0
        protected virtual bool MainTakeDamage(DamageData hData)
        {
            if (!m_hActorControler.TryGetActorData(out ActorData hActorData) ||
                !m_hBaseActorStatus.TryGetStatusData(out ActorStatus hStatusData))
            {
                return(false);
            }

            // Ignore damage during IFrame.
            if (FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.IFrame) &&
                !FlagUtility.HasFlagUnsafe(hData.m_ePenetrateType, DamagePenetrateFlag.IFrame))
            {
                return(false);
            }

            int nDamage = hData.m_nDamage;

            if (nDamage <= 0 || hStatusData == null)
            {
                //StartDamageBehaviour(hData.m_arrBehaviour);
                return(false);
            }



            m_hActorControler.InterruptAllBehaviour();

            var nCurrentHp = hStatusData.m_nCurrentHp;

            nCurrentHp -= nDamage;
            if (nCurrentHp < 0)
            {
                nCurrentHp = 0;
            }

            hStatusData.m_nCurrentHp = nCurrentHp;

            if (nCurrentHp == 0)
            {
                Dead(hData);
            }
            else
            {
                //RunAllTakeDamageEvent(hData);
                m_hDamageableEvent.Run(DamageableEvent.TakeDamage, hData);
                //StartDamageBehaviour(hData.m_arrBehaviour);
            }

            return(true);
        }
 protected override void OnUpdate()
 {
     Entities.ForEach((ref DSC_ADD_CursorLock hCursor
                       , in DSC_ADD_CursorLockByInput hLockInput
                       , in DSC_ADD_Input hInput) =>
     {
         if (FlagUtility.HasFlagUnsafe(hInput.m_eButtonDown, hLockInput.m_eLockButton))
         {
             hCursor.m_eLockMode = CursorLockMode.Locked;
         }
         else if (FlagUtility.HasFlagUnsafe(hInput.m_eButtonDown, hLockInput.m_eUnlockButton))
         {
             hCursor.m_eLockMode = CursorLockMode.None;
         }
     }).ScheduleParallel();
        protected override void OnUpdate()
        {
            Entities.ForEach((ref DSC_ADD_Jump hJump
                              , in DSC_ADD_Input hInput) =>
            {
                if (hJump.m_bJumpInput)
                {
                    return;
                }

                if (FlagUtility.HasFlagUnsafe(hInput.m_eButtonDown, hJump.m_eButton))
                {
                    hJump.m_bJumpInput = true;
                }
            }).ScheduleParallel();
        }
Example #25
0
        void MainRemoveEventListener(NetworkMode eMode, DSC_NetworkEventType eEvent, UnityAction hAction, EventOrder eOrder = EventOrder.Normal)
        {
            if (FlagUtility.HasFlagUnsafe(eMode, NetworkMode.Host))
            {
                hostEvent?.Remove(eEvent, hAction, eOrder);
            }

            if (FlagUtility.HasFlagUnsafe(eMode, NetworkMode.Client))
            {
                clientEvent?.Remove(eEvent, hAction, eOrder);
            }

            if (FlagUtility.HasFlagUnsafe(eMode, NetworkMode.Server))
            {
                serverEvent?.Remove(eEvent, hAction, eOrder);
            }
        }
Example #26
0
 protected override void MainRemove(EventKey hKey, UnityAction hAction, EventOrder eOrderType = EventOrder.Normal)
 {
     if (m_ieAllKey.Contains(hKey))
     {
         RemoveThisEvent(hKey, hAction, eOrderType);
     }
     else
     {
         foreach (var hCheckKey in m_ieAllKey)
         {
             if (FlagUtility.HasFlagUnsafe(hKey, hCheckKey))
             {
                 RemoveThisEvent(hCheckKey, hAction, eOrderType);
             }
         }
     }
 }
Example #27
0
 public override void Run(EventKey hKey)
 {
     if (m_ieAllKey.Contains(hKey))
     {
         RunThisEvent(hKey);
     }
     else
     {
         foreach (var hCheckKey in m_ieAllKey)
         {
             if (FlagUtility.HasFlagUnsafe(hKey, hCheckKey))
             {
                 RunThisEvent(hCheckKey);
             }
         }
     }
 }
Example #28
0
        protected virtual void FixedUpdate()
        {
            if (Global_GameplayManager.myTimeScale == 0)
            {
                return;
            }

            FixedExecuteBehaviour();

            if (FlagUtility.HasFlagUnsafe(m_hData.m_eStateFlag, ActorStateFlag.Jumping) && m_hData.m_hRigid)
            {
                if (Time.time >= m_hData.m_fJumpStartTime + 0.05f && m_hData.m_hRigid.velocity.y <= 0)
                {
                    m_hData.m_eStateFlag &= ~ActorStateFlag.Jumping;
                }
            }
        }
Example #29
0
        public virtual void OnJump(InputAction.CallbackContext hContext)
        {
            m_fJumpInputLastTime = Time.time;


            var eGet = OnPressInput(InputEventType.Jump, hContext.ReadValue <float>());



            if (eGet == GetInputType.Down && FlagUtility.HasFlagUnsafe(m_hActorData.m_eStateFlag, ActorStateFlag.IsGrounding))
            {
                m_hActorData.m_eStateFlag |= ActorStateFlag.HoldingJump;
            }
            else if (eGet == GetInputType.HoldEnd || eGet == GetInputType.Up)
            {
                m_hActorData.m_eStateFlag &= ~ActorStateFlag.HoldingJump;
            }
        }
Example #30
0
        protected virtual void Update()
        {
            if (FlagUtility.HasFlagUnsafe(m_hActorController.actorData.m_eStateFlag, ActorStateFlag.IsDamage))
            {
                if (Time.time >= m_fLastDamageTime + m_fIFrameAfterDamageDuration)
                {
                    m_hActorController.actorData.m_eStateFlag &= ~ActorStateFlag.IsDamage;
                }
            }

            if (FlagUtility.HasFlagUnsafe(m_hActorController.actorData.m_eStateFlag, ActorStateFlag.Freezing))
            {
                if (Time.time >= m_fLastDamageTime + m_fFreezeDuration)
                {
                    m_hActorController.actorData.m_eStateFlag &= ~ActorStateFlag.Freezing;
                }
            }
        }