Ejemplo n.º 1
0
    public void SetPath(Vector3 source, Vector3 destination, Vector3 direction, GravityStatus status)
    {
        // TODO: handOffset needs to be adjusted using controller rotation (or just local transform?) so that relative position is maintained.
        source += handOffset;

        Vector3 midpoint        = source + (destination - source) / 2;
        float   curveAdjustment = Vector3.Distance(source, destination) / (1 / curveHeight);

        midpoint += Vector3.up * curveAdjustment;
        midpoint += direction * curveAdjustment;

        Vector3[] points = { source, midpoint, destination };
        pathCreator.bezierPath = new BezierPath(points);

        lineRenderer.enabled = true;
        if (status == GravityStatus.PRIMED)
        {
            lineRenderer.material = brightHighlight;
        }
        else if (status == GravityStatus.TARGETTED)
        {
            lineRenderer.material = dimHighlight;
        }
        else
        {
            lineRenderer.enabled = false;
            return;
        }

        for (int i = 0; i < lineSegments; i++)
        {
            lineRenderer.SetPosition(i, pathCreator.path.GetPointAtDistance(i / (float)lineSegments * pathCreator.path.length));
        }
    }
Ejemplo n.º 2
0
    }                                                  //NPCか否か

    ///////////////////////////////////////////////////////////////////////////
    //  公開関数
    ///////////////////////////////////////////////////////////////////////////
    //データ設定===============================================================
    public void Initialize(PlayerCharStateData aData)
    {
        //モデル変更
        this.ModeChange(Database.obj.GetPlayerModel(aData.modelId));

        //アンカー
        m_AncData       = m_CouresAncs.GetAnc(0);
        m_AncDataGround = m_CouresAncs.GetAnc(0);

        //ステータス
        m_wait     = aData.wait;
        m_Gravity  = new GravityStatus();
        m_Speed    = new SpeedStatus(aData.accel, aData.turn, aData.maxSpeed);
        m_Jump     = new JumpStatus();
        m_Glider   = new GliderStatus();
        m_Heat     = new HeatStatus();
        m_Rack     = RackState.READY;
        m_GoalData = new GoalData();

        //ステート
        m_TrgState = new BoolArray32(false);
        m_NowState = new BoolArray32(false);

        InputStart();   //入力
        CameraStart();  //カメラ

        SpeedStart();   //速度・方向
        StartPhysics(); //重力やレイキャスト
        SpwanStart();   //復帰する処理用
        TurnnStart();   //ターン

        GoalStart();
    }
    private Raycaster m_FrontRay;                                //移動方向レイ

    //初期化===================================================================
    private void StartPhysics()
    {
        //接触
        GROUND_MASK    = 0x1 << LayerMask.NameToLayer(LayerNames.Ground);
        m_UnderRay     = new Raycaster();
        m_FrontDownRay = new Raycaster();
        m_FrontRay     = new Raycaster();
        m_Gravity      = new GravityStatus();
    }
Ejemplo n.º 4
0
    ///////////////////////////////////////////////////////////////////////////
    //  公開関数
    ///////////////////////////////////////////////////////////////////////////
    //データ設定===============================================================
    public void Initialize(PlayerCharStateData aData)
    {
        //モデル変更
        this.ModeChange(Database.obj.GetPlayerModel(aData.modelId));

        //アンカー
        m_AncData        = m_CouresAncs.GetAnc(0);
        m_AncDataGround  = m_CouresAncs.GetAnc(0);

        //ステータス
        m_wait  = aData.wait;
        m_Gravity    = new GravityStatus();
        m_Speed      = new SpeedStatus(aData.accel, aData.turn, aData.maxSpeed);
        m_Jump       = new JumpStatus();
        m_Glider     = new GliderStatus();
        m_Heat       = new HeatStatus();
        m_Rack       = RackState.READY;
        m_GoalData   = new GoalData();

        //ステート
        m_TrgState = new BoolArray32(false);
        m_NowState    = new BoolArray32(false);

        InputStart();   //入力
        CameraStart(); //カメラ

        SpeedStart();   //速度・方向
        StartPhysics(); //重力やレイキャスト
        SpwanStart();   //復帰する処理用
        TurnnStart();   //ターン

        GoalStart();
    }
 //初期化===================================================================
 private void StartPhysics()
 {
     //接触
     GROUND_MASK      = 0x1 << LayerMask.NameToLayer(LayerNames.Ground);
     m_UnderRay       = new Raycaster();
     m_FrontDownRay   = new Raycaster();
     m_FrontRay       = new Raycaster();
     m_Gravity        = new GravityStatus();
 }