Exemple #1
0
    //更新関数
    public override Vector3 Activate(ref Vector3 lookAtPos)
    {
        Vector3 movePosition = Vector3.zero;

        movePosition = currentState.Activate(ref lookAtPos);
        currentState.IsChanging(this);
        return(movePosition);
    }
    //更新関数
    public void Activate()
    {
        //ゲーム全体の初期化後の初期化処理
        if (!initialized)
        {
            initialized = true;
            stateMachine.Initialize(gameObject);
            weaponStateMachine.Initialize(gameObject);
            GameDirector.Instance().ui_Director.InstanceUI("HP", gameObject);
        }

        lookAtPosition = transform.position + transform.forward;
        Vector3 movePosition = stateMachine.Activate(ref lookAtPosition);

        //ギミックなどによる移動制限
        movePosition = OtherMovePosition(movePosition);

        //スライド移動用のカメラにする
        if (status.GetSlideButton())
        {
            Camera.main.GetComponent <CameraDirector>().AddObserver(obCamera);
            Vector3 vecCameraPlaneForward = Camera.main.transform.forward;
            vecCameraPlaneForward.y = 0;

            lookAtPosition = transform.position + vecCameraPlaneForward;
        }
        else
        {
            Camera.main.GetComponent <CameraDirector>().RemoveObserver(obCamera);
        }

        //武器の状態更新
        if (!nUW && !status.GetDead())
        {
            weaponStateMachine.Activate();
        }

        //HPが0になったらゲームオーバー
        if (status.GetDead())
        {
            GameDirector.Instance().toGameOver.toGameOver();
        }

        //カメラ視点更新
        transform.LookAt(lookAtPosition);

        //プレイヤー移動更新
        if (useWarp)
        {
            transform.position = movePosition;
        }
        else
        {
            charCon.Move(movePosition);
        }
    }
Exemple #3
0
    public override Vector3 Activate(ref Vector3 lookAtPos)
    {
        waitingTimer += Time.fixedDeltaTime;

        Vector3 movePosition = Vector3.zero;

        movePosition = currentState.Activate(ref lookAtPos);
        currentState.IsChanging(this);

        return(movePosition);
    }