#pragma warning restore 0649
        #endregion

        public override void RunEvent(BaseActorController hBaseController, BaseActorBehaviour hBaseBehaviour)
        {
            if (!hBaseController.TryGetActorData(out ActorData hActorData))
            {
                return;
            }

            if (!m_arrFlag.HasData())
            {
                return;
            }

            if (hActorData.m_hFlag)
            {
                switch (m_eLockType)
                {
                case LockType.Lock:
                    for (int i = 0; i < m_arrFlag.Length; i++)
                    {
                        hActorData.m_hFlag.AddFlag(FlagType.Lock, m_arrFlag[i], hBaseBehaviour);
                    }
                    break;

                case LockType.Unlock:
                    for (int i = 0; i < m_arrFlag.Length; i++)
                    {
                        hActorData.m_hFlag.RemoveFlag(FlagType.Lock, m_arrFlag[i], hBaseBehaviour);
                    }
                    break;
                }
            }
        }
Beispiel #2
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;
            }
        }
        void EndWallJump(BaseActorController hBaseController, WallJumpCacheData hData)
        {
            hData.m_bWallJumping       = false;
            hData.m_fWallJumpTimeCount = 0;

            m_arrJumpEndEvent.RunEvent(hBaseController, this);
        }
Beispiel #4
0
        void OnJump(BaseActorController hBaseController)
        {
            if (hBaseController.isTimeStop || !PassCondition(hBaseController))
            {
                return;
            }

            if (!hBaseController.TryGetActorData(out BaseActorData2D hActorData))
            {
                return;
            }

            var hInput = hBaseController.baseActorInput;

            if (hInput == null || hActorData.m_hPhysic == null)
            {
                return;
            }

            float fJumpForce = m_fJumpForce;

            if (m_hJumpForceValue)
            {
                m_hJumpForceValue.CalculateValue(ref fJumpForce);
            }

            hActorData.m_hPhysic.AddForce(new Vector2(0, fJumpForce));

            m_arrJumpEvent.RunEvent(hBaseController, this);
        }
Beispiel #5
0
        public ActorData(Transform hActor, BaseActorController <ActorData, DSC_ActorBehaviour> hController)
        {
            m_hActor      = hActor;
            m_hController = hController;

            InitData();
        }
Beispiel #6
0
 protected virtual void Start()
 {
     m_hActorController = GetComponent <BaseActorController <ActorData, DSC_ActorBehaviour> >();
     if (m_hActorController)
     {
         m_hActorData = m_hActorController.actorData;
     }
 }
 private void Awake()
 {
     m_hActorController = GetComponent <DSC_ActorController>();
     m_hActorController.AddBehaviourData(new ActorMonoData <Actor_AmmoController>
     {
         m_hMono = this
     });
 }
Beispiel #8
0
 public override void OnStopBehaviour(BaseActorController hBaseController)
 {
     if (hBaseController.TryGetIActorData(out IActorData_Input hDataInput) &&
         hBaseController.TryGetBehaviourData(out JumpCacheData hOutData))
     {
         hDataInput.inputButtonCallback.Remove((m_eButton, GetInputType.Down), hOutData.m_actJump);
     }
 }
Beispiel #9
0
 public override void OnDestroyBehaviour(BaseActorController hBaseController)
 {
     if (hBaseController.TryGetBehaviourData(out JumpCacheData hOutData, out int nOutIndex))
     {
         DSC_Pooling.AddPooling(hOutData);
         hBaseController.RemoveBehaviourData(nOutIndex);
     }
 }
Beispiel #10
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override void OnFixedUpdateBehaviour(BaseActorController hBaseController)
        {
            if (!PassCondition(hBaseController))
            {
                return;
            }

            OnGravityIncrease(hBaseController);
        }
        void OnJumpButtonUp(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetBehaviourData(out WallJumpCacheData hOutData))
            {
                return;
            }

            hOutData.m_bJumpButtonUp = true;
        }
Beispiel #12
0
        public override void RunEvent(BaseActorController hBaseController, BaseActorBehaviour hBaseBehaviour)
        {
            if (!hBaseController.TryGetActorData(out ActorData hActorData))
            {
                return;
            }

            hActorData.m_eStateFlag |= ActorStateFlag.Jumping;
            hActorData.m_eStateFlag &= ~ActorStateFlag.Falling;
        }
        public override void OnInterruptBehaviour(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetBehaviourData(out WallJumpCacheData hData) ||
                !hData.m_bWallJumping)
            {
                return;
            }

            EndWallJump(hBaseController, hData);
        }
Beispiel #14
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));
        }
Beispiel #15
0
        public override void OnStartBehaviour(BaseActorController hBaseController)
        {
            base.OnStartBehaviour(hBaseController);

            if (hBaseController.TryGetIActorData(out IActorData_Input hDataInput) &&
                hBaseController.TryGetBehaviourData(out GravityIncreaseButtonCacheData hOutData))
            {
                hDataInput.inputButtonCallback.Add((m_eStopButton, GetInputType.Down), hOutData.m_actButtonDown, EventOrder.Late);
                hDataInput.inputButtonCallback.Add((m_eStopButton, GetInputType.Up), hOutData.m_actButtonUp);
            }
        }
Beispiel #16
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));
        }
Beispiel #17
0
        public ActorData(Transform hActor)
        {
            if (hActor == null)
            {
                return;
            }

            m_hActor      = hActor;
            m_hController = hActor.GetComponent <BaseActorController <ActorData, DSC_ActorBehaviour> >();

            InitData();
        }
Beispiel #18
0
        protected override void OnGravityIncrease(BaseActorController hBaseController)
        {
            if (hBaseController.TryGetBehaviourData(out GravityIncreaseButtonCacheData hOutData))
            {
                if (hOutData.m_bStoping)
                {
                    return;
                }
            }

            base.OnGravityIncrease(hBaseController);
        }
Beispiel #19
0
        public override void OnFixedUpdateBehaviour(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetBehaviourData(out DoubleJumpCacheData hOutData))
            {
                return;
            }

            if (!hOutData.m_bCanDoubleJump)
            {
                hOutData.m_bCanDoubleJump = m_arrResetCondition.PassCondition(hBaseController);
            }
        }
Beispiel #20
0
        protected virtual void OnGravityIncrease(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetActorData(out BaseActorData2D hActorData) ||
                hActorData.m_hPhysic == null)
            {
                return;
            }

            Vector2 vVelocity = hActorData.m_hPhysic.velocity;

            vVelocity.y += Physics2D.gravity.y * hActorData.m_hPhysic.gravityScale * m_fGravityMultiplier * hBaseController.actorFixedDeltaTime;
            hActorData.m_hPhysic.velocity = vVelocity;
        }
        void OnJump(BaseActorController hBaseController)
        {
            if (hBaseController.isTimeStop || !PassCondition(hBaseController) ||
                !hBaseController.TryGetActorData(out BaseActorData2D hActorData) ||
                !hBaseController.TryGetBehaviourData(out WallJumpCacheData hOutData) ||
                hOutData.m_bWallJumping)
            {
                return;
            }

            if (hActorData.m_hPhysic == null)
            {
                return;
            }

            hOutData.m_bWallJumping       = true;
            hOutData.m_bJumpButtonUp      = false;
            hOutData.m_fWallJumpTimeCount = 0;

            var vVelocity = hActorData.m_hPhysic.velocity;

            vVelocity.y = 0;
            hActorData.m_hPhysic.velocity = vVelocity;

            float fForceX = m_fForceX;

            if (m_hForceXValue)
            {
                m_hForceXValue.CalculateValue(ref fForceX);
            }

            float fForceY = m_fForceY;

            if (m_hForceYValue)
            {
                m_hForceYValue.CalculateValue(ref fForceY);
            }

            Vector2 vForce = new Vector2(fForceX, fForceY);

            var fAngleY = hActorData.m_hActor.localEulerAngles.y;

            if (fAngleY == 0)
            {
                vForce.x = -vForce.x;
            }

            hActorData.m_hPhysic.AddForce(vForce);

            m_arrJumpEvent.RunEvent(hBaseController, this);
        }
Beispiel #22
0
        void OnButtonUp(BaseActorController hBaseController)
        {
            if (!m_bStopByHoldButton)
            {
                return;
            }

            if (!hBaseController.TryGetBehaviourData(out GravityIncreaseButtonCacheData hOutData))
            {
                return;
            }

            hOutData.m_bStoping = false;
        }
Beispiel #23
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override void OnCreateBehaviour(BaseActorController hBaseController)
        {
            if (DSC_Pooling.TryGetPooling(out JumpCacheData hOutData))
            {
                hBaseController.AddBehaviourData(hOutData);
            }
            else
            {
                hBaseController.AddBehaviourData(new JumpCacheData
                {
                    m_actJump = OnJump
                });
            }
        }
Beispiel #24
0
        void OnButtonDown(BaseActorController hBaseController)
        {
            if (!m_bStopByHoldButton)
            {
                return;
            }

            if (!hBaseController.TryGetBehaviourData(out GravityIncreaseButtonCacheData hOutData))
            {
                return;
            }

            hOutData.m_bStoping  = true;
            hOutData.m_fStopTime = 0;
        }
Beispiel #25
0
#pragma warning restore 0649
        #endregion

        #region Base - Override

        public override void OnCreateBehaviour(BaseActorController hBaseController)
        {
            base.OnCreateBehaviour(hBaseController);

            if (DSC_Pooling.TryGetPooling(out GravityIncreaseButtonCacheData hOutCache))
            {
                hBaseController.AddBehaviourData(hOutCache);
            }
            else
            {
                hBaseController.AddBehaviourData(new GravityIncreaseButtonCacheData
                {
                    m_actButtonDown = OnButtonDown,
                    m_actButtonUp   = OnButtonUp
                });
            }
        }
Beispiel #26
0
#pragma warning restore 0649
        #endregion

        public override void RunEvent(BaseActorController hBaseController, BaseActorBehaviour hBaseBehaviour)
        {
            if (!hBaseController.TryGetActorData(out ActorData hActorData))
            {
                return;
            }

            float fAngle = hActorData.m_hActor.localEulerAngles.y;

            if (m_bRightDefault && fAngle == 0)
            {
                hActorData.m_eStateFlag |= ActorStateFlag.FacingRight;
            }
            else if (!m_bRightDefault && fAngle != 0)
            {
                hActorData.m_eStateFlag &= ~ActorStateFlag.FacingRight;
            }
        }
Beispiel #27
0
        public override void OnUpdateBehaviour(BaseActorController hBaseController)
        {
            base.OnUpdateBehaviour(hBaseController);

            if (!m_bHasMaxStopDuration ||
                !hBaseController.TryGetBehaviourData(out GravityIncreaseButtonCacheData hOutData) ||
                !hOutData.m_bStoping)
            {
                return;
            }

            hOutData.m_fStopTime += hBaseController.actorDeltaTime;

            if (hOutData.m_fStopTime >= m_fMaxStopDuration)
            {
                hOutData.m_bStoping = false;
            }
        }
        public override void OnUpdateBehaviour(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetBehaviourData(out WallJumpCacheData hOutData) || !hOutData.m_bWallJumping)
            {
                return;
            }

            hOutData.m_fWallJumpTimeCount += hBaseController.actorDeltaTime;
            float fLockFlagDuration = m_fLockFlagDuration;

            if (hOutData.m_bJumpButtonUp)
            {
                fLockFlagDuration *= 0.5f;
            }

            if (hOutData.m_fWallJumpTimeCount >= fLockFlagDuration)
            {
                EndWallJump(hBaseController, hOutData);
                return;
            }
        }
Beispiel #29
0
        void OnJump(BaseActorController hBaseController)
        {
            if (hBaseController.isTimeStop || !PassCondition(hBaseController))
            {
                return;
            }

            if (!hBaseController.TryGetActorData(out BaseActorData2D hActorData) ||
                !hBaseController.TryGetBehaviourData(out DoubleJumpCacheData hOutData) || !hOutData.m_bCanDoubleJump)
            {
                return;
            }

            var hInput = hBaseController.baseActorInput;

            if (hInput == null || hActorData.m_hPhysic == null)
            {
                return;
            }

            hOutData.m_bCanDoubleJump = false;

            var vVelocity = hActorData.m_hPhysic.velocity;

            vVelocity.y = 0;
            hActorData.m_hPhysic.velocity = vVelocity;

            float fJumpForce = m_fJumpForce;

            if (m_hJumpForceValue)
            {
                m_hJumpForceValue.CalculateValue(ref fJumpForce);
            }

            hActorData.m_hPhysic.AddForce(new Vector2(0, fJumpForce));

            m_arrJumpEvent.RunEvent(hBaseController, this);
        }
Beispiel #30
0
        public override void OnFixedUpdateBehaviour(BaseActorController hBaseController)
        {
            if (!hBaseController.TryGetActorData(out ActorData hActorData) ||
                !PassCondition(hBaseController))
            {
                return;
            }

            if (hActorData.m_hPhysic)
            {
                Vector2 vVelocity = hActorData.m_hPhysic.velocity;

                if (!FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.IsGrounding) &&
                    !FlagUtility.HasFlagUnsafe(hActorData.m_eStateFlag, ActorStateFlag.Falling))
                {
                    if (vVelocity.y < 0)
                    {
                        hActorData.m_eStateFlag |= ActorStateFlag.Falling;
                        hActorData.m_eStateFlag &= ~ActorStateFlag.Jumping;
                    }
                }
            }
        }