Veilheim/Blueprints/BlueprintManager.cs
/// <summary>
///     Add some camera height while planting a blueprint
/// </summary>
Add some camera height while planting a blueprint
Add some camera height while planting a blueprint
private void AdjustCameraHeight(On.GameCamera.orig_UpdateCamera orig, GameCamera self, float dt)
        {
            orig(self, dt);
            if (Player.m_localPlayer != null)
            {
                if (Player.m_localPlayer.InPlaceMode())
                {
                    if (Player.m_localPlayer.m_placementGhost)
                    {
                        var pieceName = Player.m_localPlayer.m_placementGhost.name;
                        if (pieceName.StartsWith("make_blueprint"))
                        {
                            if (Input.GetKey(KeyCode.LeftShift))
                            {
                                float minOffset = 0f;
                                float maxOffset = 20f;
                                if (Input.GetAxis("Mouse ScrollWheel") < 0f)
                                {
                                    Instance.cameraOffsetMake = Mathf.Clamp(Instance.cameraOffsetMake += 1f, minOffset, maxOffset);
                                }
                                if (Input.GetAxis("Mouse ScrollWheel") > 0f)
                                {
                                    Instance.cameraOffsetMake = Mathf.Clamp(Instance.cameraOffsetMake -= 1f, minOffset, maxOffset);
                                }
                            }
                            self.transform.position += new Vector3(0, Instance.cameraOffsetMake, 0);
                        }
                        if (pieceName.StartsWith("piece_blueprint"))
                        {
                            if (Input.GetKey(KeyCode.LeftShift))
                            {
                                float minOffset = 2f;
                                float maxOffset = 20f;
                                if (Input.GetAxis("Mouse ScrollWheel") < 0f)
                                {
                                    Instance.cameraOffsetPlace = Mathf.Clamp(Instance.cameraOffsetPlace += 1f, minOffset, maxOffset);
                                }
                                if (Input.GetAxis("Mouse ScrollWheel") > 0f)
                                {
                                    Instance.cameraOffsetPlace = Mathf.Clamp(Instance.cameraOffsetPlace -= 1f, minOffset, maxOffset);
                                }
                            }
                            self.transform.position += new Vector3(0, Instance.cameraOffsetPlace, 0);
                        }
                    }
                }
            }
        }
private void AdjustCameraHeight ( On . GameCamera . orig_UpdateCamera orig , GameCamera self , float dt ) { orig ( self , dt ) ; if ( Player . m_localPlayer != null ) { if ( Player . m_localPlayer . InPlaceMode ( ) ) { if ( Player . m_localPlayer . m_placementGhost ) { var pieceName = Player . m_localPlayer . m_placementGhost . name ; if ( pieceName . StartsWith ( " " ) ) { if ( Input . GetKey ( KeyCode . LeftShift ) ) { float minOffset = 0f ; float maxOffset = 20f ; if ( Input . GetAxis ( " " ) < 0f ) { Instance . cameraOffsetMake = Mathf . Clamp ( Instance . cameraOffsetMake += 1f , minOffset , maxOffset ) ; } if ( Input . GetAxis ( " " ) > 0f ) { Instance . cameraOffsetMake = Mathf . Clamp ( Instance . cameraOffsetMake -= 1f , minOffset , maxOffset ) ; } } self . transform . position += new Vector3 ( 0 , Instance . cameraOffsetMake , 0 ) ; } if ( pieceName . StartsWith ( " " ) ) { if ( Input . GetKey ( KeyCode . LeftShift ) ) { float minOffset = 2f ; float maxOffset = 20f ; if ( Input . GetAxis ( " " ) < 0f ) { Instance . cameraOffsetPlace = Mathf . Clamp ( Instance . cameraOffsetPlace += 1f , minOffset , maxOffset ) ; } if ( Input . GetAxis ( " " ) > 0f ) { Instance . cameraOffsetPlace = Mathf . Clamp ( Instance . cameraOffsetPlace -= 1f , minOffset , maxOffset ) ; } } self . transform . position += new Vector3 ( 0 , Instance . cameraOffsetPlace , 0 ) ; } } } } }
Add some camera height while planting a blueprint
Add some camera height while planting a blueprint
// TODO: base min/max off of selected piece dimensions
orig
On.GameCamera.orig_UpdateCamera
self
GameCamera
dt
float