コード例 #1
0
ファイル: Player.cs プロジェクト: Kierz/UOP-Gamejam-2014
    public void ShootStone()
    {
        if (!passedTheLine)
        {
            canShoot   = false;
            canControl = false;

            // apply our current velocity to the stone
            stoneClone.rigidbody.AddForce(rigidbody.velocity * DEFAULT_FORCE);

            SwitchState(GameManager.eGameState.eRock);     //switch to rockCamera which follows the stone
            stoneClone.Fire();                             //this will call StoneFired() when the stone stops moving
            StartCoroutine(AllowRockToPassCameraBack());
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: vulpenie1/UOP-Gamejam-2014
    public void ShootStone()
    {
        //stoneClone.transform.parent = null;

        SwitchCamera(GameManager.eGameState.eRock);

        Vector3 forwardForce = transform.forward;

        forwardForce.x *= rigidbody.velocity.magnitude * 100f;
        forwardForce.y *= rigidbody.velocity.magnitude * 100f;
        forwardForce.z *= rigidbody.velocity.magnitude * 100f;
        //stoneClone.rigidbody.velocity = rigidbody.velocity;

        stoneClone.rigidbody.AddForce(forwardForce);


        stoneClone.Fire();
        canShoot   = false;
        canControl = false;

        // must be at the end
        StartCoroutine(StoneFired());
    }