Exemplo n.º 1
0
        public override IPlayerState GetNextState(PlayerComponent arg_player)
        {
            if (arg_player.m_inputHandle.m_reach)
            {
                return(new PlayerReachState(this));
            }
            if (arg_player.m_isGrounded)
            {
                return(new OnPlayerGroundedState().GetNextState(arg_player));
            }

            if (arg_player.m_inputHandle.m_run)
            {
                if (m_directionBuf != arg_player.m_direction)
                {
                    return(new PlayerAirRunState(arg_player.m_direction));
                }
            }
            else
            {
                return(new PlayerAirIdleState());
            }

            return(null);
        }
Exemplo n.º 2
0
 public virtual IPlayerState GetNextState(PlayerComponent arg_player)
 {
     if (arg_player.m_inputHandle.m_run)
     {
         return(new PlayerAirRunState(arg_player.m_direction));
     }
     return(new PlayerAirIdleState());
 }
Exemplo n.º 3
0
 public virtual IPlayerState GetNextState(PlayerComponent arg_player)
 {
     if (!arg_player.m_inputHandle.m_reach)
     {
         return(m_stateBuf);
     }
     return(null);
 }
Exemplo n.º 4
0
 public override void OnGraspedStay(PlayerComponent arg_player)
 {
     this.m_transform.position = arg_player.Arm.GetTopPosition();
     if (arg_player.m_currentState.GetType() != typeof(PlayerReachState))
     {
         arg_player.m_rigidbody.isKinematic = false;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// ステート開始時
        /// </summary>
        /// <param name="arg_player"></param>
        public void OnEnter(PlayerComponent arg_player)
        {
            m_velocityBuf = arg_player.m_rigidbody.velocity;
            arg_player.m_rigidbody.isKinematic = true;
            arg_player.m_rigidbody.velocity    = Vector2.zero;
            m_directionBuf = arg_player.m_direction;

            arg_player.Arm.StartLengthen();
        }
Exemplo n.º 6
0
        public override void OnGraspedEnter(PlayerComponent arg_player)
        {
#if DEVELOP
            Debug.Log("Grasped : Enter");
#endif
            base.OnGraspedEnter(arg_player);
            arg_player.Arm.m_shorten = true;
            m_direction = ((Vector2)arg_player.Arm.m_transform.position - arg_player.Arm.m_targetPosition).normalized;
            arg_player.m_rigidbody.isKinematic = true;
        }
Exemplo n.º 7
0
        public override void OnGraspedExit(PlayerComponent arg_player)
        {
#if DEVELOP
            Debug.Log("Grasped : Exit");
#endif

            base.OnGraspedExit(arg_player);
            arg_player.m_rigidbody.isKinematic = false;
            arg_player.m_inputHandle.m_reach   = false;
        }
Exemplo n.º 8
0
 public void PlayerGenerate(PlayerComponent arg_player)
 {
     foreach (StartPoint point in m_startPoints)
     {
         if (point.m_id == START_POINT_ID)
         {
             point.m_isActive = true;
             point.Generate(arg_player);
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// ステート中の更新
        /// </summary>
        /// <param name="arg_player"></param>
        public void OnUpdate(PlayerComponent arg_player)
        {
            arg_player.m_transform.position = arg_player.Arm.GetBottomPosition();
            arg_player.m_direction          = m_directionBuf;

            if (!arg_player.Arm.m_isActive)
            {
                arg_player.m_inputHandle.m_reach = false;
                return;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// ステート終了時
        /// </summary>
        /// <param name="arg_player"></param>
        public void OnExit(PlayerComponent arg_player)
        {
            if (!arg_player.Hand.m_graspingItem)
            {
                arg_player.m_rigidbody.isKinematic = false;
            }
            if (m_velocityBuf.y > 0)
            {
                m_velocityBuf.y = 0;
            }

            arg_player.m_rigidbody.velocity = m_velocityBuf;
        }
Exemplo n.º 11
0
        /// <summary>
        /// ステート中の更新
        /// </summary>
        /// <param name="arg_player"></param>
        public override void OnUpdate(PlayerComponent arg_player)
        {
            if (Physics2D.BoxCast(arg_player.m_transform.position,
                                  arg_player.m_collider.size, 0,
                                  new Vector2((int)arg_player.m_direction, 0),
                                  0.1f, 1 << LayerMask.NameToLayer("Ground")))
            {
                return;
            }

            arg_player.m_transform.position += new Vector3()
            {
                x = arg_player.m_speed * (int)arg_player.m_direction,
                y = 0,
                z = 0
            };
        }
Exemplo n.º 12
0
        public override void OnGraspedStay(PlayerComponent arg_player)
        {
#if DEVELOP
            Debug.Log("Grasped : Update");
#endif

            ArmComponent arm = arg_player.Arm;

            if (arm.m_lengthBuf.Count > 0)
            {
                arm.m_transform.position = m_transform.position + (m_direction * arm.m_lengthBuf.Peek());
            }
            else
            {
                arm.m_transform.position = m_transform.position;
                arg_player.gameObject.transform.position = arm.m_transform.position = transform.position;
            }
            arg_player.m_rigidbody.velocity = Vector2.zero;
        }
Exemplo n.º 13
0
 public void SetOwner(PlayerComponent arg_player)
 {
     m_owner = arg_player;
 }
Exemplo n.º 14
0
 /// <summary>
 /// ステート終了時
 /// </summary>
 /// <param name="arg_player"></param>
 public override void OnExit(PlayerComponent arg_player)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// ステート開始時
 /// </summary>
 /// <param name="arg_player"></param>
 public override void OnEnter(PlayerComponent arg_player)
 {
     arg_player.m_direction = m_directionBuf;
 }
Exemplo n.º 16
0
 public virtual IPlayerState GetNextState(PlayerComponent arg_player)
 {
     return(new PlayerGroundedIdleState());
 }
Exemplo n.º 17
0
 /// <summary>
 /// ステート中の更新
 /// </summary>
 /// <param name="arg_player"></param>
 public override void OnUpdate(PlayerComponent arg_player)
 {
 }
Exemplo n.º 18
0
 /// <summary>
 /// ステート中の更新
 /// </summary>
 /// <param name="arg_player"></param>
 public virtual void OnUpdate(PlayerComponent arg_player)
 {
 }
Exemplo n.º 19
0
 public virtual IPlayerState GetNextState(PlayerComponent arg_player)
 {
     return(null);
 }
Exemplo n.º 20
0
 public void Initialize(PlayerComponent arg_player)
 {
     m_xScaleBuf = m_transform.localScale.x;
 }
Exemplo n.º 21
0
 /// <summary>
 /// 掴まれていた状態から離された時の処理
 /// ここでは一度だけ呼ばせること
 /// </summary>
 /// <param name="arg_player"></param>
 public virtual void OnGraspedExit(PlayerComponent arg_player)
 {
     //TODO:掴まれているの処理
     //Armを縮めるのか、固定なのか、自分もついていくのか
     //また、持ち運ばれるのか
 }
Exemplo n.º 22
0
 public virtual void Generate(PlayerComponent arg_player)
 {
     arg_player.m_transform.position = this.transform.position;
 }
Exemplo n.º 23
0
 public override void OnGraspedExit(PlayerComponent arg_player)
 {
     arg_player.m_inputHandle.m_reach = false;
 }
Exemplo n.º 24
0
 public virtual void Initialize(PlayerComponent arg_player)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 /// ステート開始時
 /// </summary>
 /// <param name="arg_player"></param>
 public virtual void OnEnter(PlayerComponent arg_player)
 {
 }
Exemplo n.º 26
0
 public override void OnGraspedStay(PlayerComponent arg_player)
 {
 }
Exemplo n.º 27
0
 /// <summary>
 /// ステート終了時
 /// </summary>
 /// <param name="arg_player"></param>
 public virtual void OnExit(PlayerComponent arg_player)
 {
 }
Exemplo n.º 28
0
 public override void OnGraspedExit(PlayerComponent arg_player)
 {
     arg_player.Arm.m_shorten = true;
 }
Exemplo n.º 29
0
 public override void OnGraspedEnter(PlayerComponent arg_player)
 {
 }
Exemplo n.º 30
0
 public override IPlayerState GetNextState(PlayerComponent arg_player)
 {
     return(new OnPlayerAirState().GetNextState(arg_player));
 }