Beispiel #1
0
    public override void Initialize()
    {
        base.Initialize();
        //現在位置の登録
        currentPosition = playerMove.transform.position;
        isEnd           = false;
        time            = 0.0f;

        LaneLocationType prevLocationType = playerMove.LocationType;

        playerMove.RightSideMoveTypeChange();

        //動きに変更がなかった場合
        if (prevLocationType == playerMove.LocationType)
        {
            isEnd = true;
        }
    }
    /// <summary>
    /// 曲がる際にレーン移動の位置を変更する
    /// </summary>
    /// <param name="subStage"></param>
    public bool CurveToChangeLanePosition()
    {
        //進む方向が同じなら
        if (IsChangeDirection() == true)
        {
            return(false);
        }

        //レーンの位置をモデルの位置にする
        transform.position = playerModelObject.transform.position;
        LaneLocationType type = transform.parent.GetComponentInChildren <PlayerMove>().LocationType;

        playerModelObject.transform.eulerAngles = GetExitPlayerAngle();
        transform.eulerAngles = GetExitPlayerAngle();

        switch (subStageObject.ExitType)
        {
        case GatewayType.East:
            if (type == LaneLocationType.LEFT_SIDE)
            {
                transform.localPosition -= new Vector3(0.0f, 0.0f, 2.0f);
            }
            else if (type == LaneLocationType.RIGHT_SIDE)
            {
                transform.localPosition += new Vector3(0.0f, 0.0f, 2.0f);
            }
            break;

        case GatewayType.West:
            if (type == LaneLocationType.LEFT_SIDE)
            {
                transform.localPosition += new Vector3(0.0f, 0.0f, 2.0f);
            }
            else if (type == LaneLocationType.RIGHT_SIDE)
            {
                transform.localPosition -= new Vector3(0.0f, 0.0f, 2.0f);
            }

            break;

        case GatewayType.South:
            if (type == LaneLocationType.LEFT_SIDE)
            {
                transform.localPosition -= new Vector3(2.0f, 0.0f, 0.0f);
            }
            else if (type == LaneLocationType.RIGHT_SIDE)
            {
                transform.localPosition += new Vector3(2.0f, 0.0f, 0.0f);
            }

            break;

        case GatewayType.North:
            if (type == LaneLocationType.LEFT_SIDE)
            {
                transform.localPosition += new Vector3(2.0f, 0.0f, 0.0f);
            }
            else if (type == LaneLocationType.RIGHT_SIDE)
            {
                transform.localPosition -= new Vector3(2.0f, 0.0f, 0.0f);
            }
            break;
        }
        return(true);
    }
Beispiel #3
0
 public override void OnCreate()
 {
     LocationType  = LaneLocationType.MIDDLE;
     lanePositions = transform.parent.GetComponentInChildren <LanePositions>();
     lanePositions.Initialize();
 }
Beispiel #4
0
    /// <summary>
    /// 右レーンへの状態を変更する
    /// </summary>
    public void RightSideMoveTypeChange()
    {
        int max = Enum.GetValues(typeof(LaneLocationType)).Length - 1;

        LocationType = (LaneLocationType)Mathf.Clamp((int)LocationType + 1, 0, max);
    }
Beispiel #5
0
 public void OffsetPosition(Vector3 currentPosition, float t)
 {
     LocationType = LaneLocationType.MIDDLE;
     Move(currentPosition, t);
 }