From fdbfe31a9784bd53091b30413e6ea835c18ddb55 Mon Sep 17 00:00:00 2001 From: Spencer Wilson Date: Fri, 5 May 2017 23:31:23 -0700 Subject: [PATCH 1/6] Leaning Mechanic (WIP) Date Modified: 5/5/2017 @ 11:28 pm Changelog: Added the beginnings of the PlayerLean() function. Was working fine before, need to work out the glitches now. Unity says that you can't have multiple transforms in the Debug Console, or something of the sort when I run the program and press 'q' or 'e' (Leaning Mechanic). --- .../Assets/Scripts/PlayerControl.cs | 60 +++++++++++------- .../Assets/_Scenes/Spencer_Test.unity | Bin 22496 -> 23084 bytes 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs index 54d143d..9236f38 100755 --- a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs +++ b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs @@ -1,7 +1,7 @@ /* * * Author: Spencer Wilson - * Date: 3/14/2017 (Happy Pi-Day everyone!) + * Date: 5/5/2017, 11:28 pm * File: PlayerControl.cs * Description: This file contains the code that takes user input in order to control the character. * Disclaimer: A majority of this code I have gotten from tutorials. I have not been simply copying them, I have been @@ -62,10 +62,10 @@ private void Update() void FixedUpdate() // Used a tutorial, hopefully going to be expanding on this method to suit the game's needs and functionalities. { PlayerRotation(); // Calls upon the PlayerRotation() function. - //PlayerRun(); // Calls upon the PlayerRun() function. + PlayerRun(); // Calls upon the PlayerRun() function. PlayerMovement(); // Calls upon the PlayerMovement() function. //PlayerCrouch(); // Calls upon the PlayerCrouch() function. - //PlayerLean(); // Calls upon the PlayerLean() function. + PlayerLean(); // Calls upon the PlayerLean() function. //PlayerProne(); // Calls upon the PlayerProne() function. PlayerPause(); } @@ -192,27 +192,41 @@ void PlayerCrouch() - void PlayerLean() - { - if (Input.GetKeyDown("q")) - { - // Insert Lean Left Code Here - } - if (Input.GetKeyUp("q")) - { - // Insert Return To Normal Posture Code Here - } - if (Input.GetKeyDown("e")) - { - // Insert Lean Right Code Here - } - if (Input.GetKeyUp("e")) - { - // Insert Return To Normal Posture Code Here - } - } + void PlayerLean() + { + float zRotation = 10f; // Holds value for rotation along the z-axis. + float yRotation = 0; // Holds value for rotation along the y-axis. + const float MAXZROTATION = (3f * Mathf.PI) / 2f; + const float MINZROTATION = (Mathf.PI) / 4f; + float newXRotation; + + if (Input.GetKeyDown("q")) + { + Debug.Log("Lean Left"); + transform.localEulerAngles = new Vector3(0f, 0f, zRotation); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + } + if (Input.GetKeyUp("q")) + { + Debug.Log("Upright position"); + transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + } + if (Input.GetKeyDown("e")) + { + Debug.Log("Lean Right"); + transform.localEulerAngles = new Vector3(0f, 0f, -zRotation); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + } + if (Input.GetKeyUp("e")) + { + Debug.Log("Upright position"); + transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + } + } - void PlayerProne() + void PlayerProne() { // Insert Player Prone Stuff. Might have to call upon the PlayerMovement function here to change the value of speed so it is slower when crawling. } diff --git a/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity b/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity index d7905b70d55c9d20a5a861e38811891cbff9d1e7..81cf930ec440d38680cc152fd86e935c056ac2ed 100644 GIT binary patch delta 750 zcmZ9Ku}@P`6voemN3CMvL2c?-wL%k0O3|1YtUOGV*4IFxYK;>tP@vGJ6j&gw8)MDU zgwe%KBl;L54l){}u`UKS{SP`A;$WiRh4UO}a`N5t`+Cm%di#F7RxfvyNt7xQJ&F=h z7tZxJrY9Cie(zuDt<@&qr(YcO&2J6$!2RU(#q8EDMT*{{{eU`)y2QhSK^5k&v7oxl z#lhWRCQ~Wj2&d;}^Oc)4QZxa`iaPB643yDe_pGeXz-yT ze8X?cC(qixIu^CRLP&3%@o2VF+-YI)I(gt!rq&0gkn=qslxA~?`)~{X_ymL+9->2N z4=&5hgwf&qaf{5(L^2hKH<1)U@enO>vL+KH;Jvt_@;C#bQ?L@W3s+(`Dr_{=dt2QK zk}@YU22H~wB8yo9%-!m~Y2)J0fY6nANd?L=%xW**FJcWZ%}iJ}O+54X*%(qePu2i##;=Rc}oyUgCfYkE|BCJP5Ei>X+`fs=6HGd=#Tam@ks`d|Lid)wJ From c1fe1d5567fd5028de2fedae600caa050e3e7db1 Mon Sep 17 00:00:00 2001 From: Spencer Wilson Date: Sat, 6 May 2017 23:30:34 -0700 Subject: [PATCH 2/6] Continued Work on Leaning Mechanics Committed: 5/6/2017, 11:30 pm Summary: Continued work on leaning mechanics in PlayerControl.cs. --- .../Assets/Scripts/PlayerControl.cs | 21 ++++++++++-------- .../Assets/_Scenes/Spencer_Test.unity | Bin 23084 -> 24716 bytes 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs index 9236f38..9d718c7 100755 --- a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs +++ b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs @@ -1,12 +1,9 @@ /* * * Author: Spencer Wilson - * Date: 5/5/2017, 11:28 pm + * Date: 5/6/2017, 11:28 pm * File: PlayerControl.cs * Description: This file contains the code that takes user input in order to control the character. - * Disclaimer: A majority of this code I have gotten from tutorials. I have not been simply copying them, I have been - * trying to understand them and how they effect the gameplay mechanics in the Unity engine so that I may write code on my - * own one day. Simply put, they are a learning aid and have helped guide me along the process of creation. * */ @@ -194,8 +191,10 @@ void PlayerCrouch() void PlayerLean() { - float zRotation = 10f; // Holds value for rotation along the z-axis. - float yRotation = 0; // Holds value for rotation along the y-axis. + float zBodyRotation = 10f; // Holds value for rotation along the z-axis. + float yBodyRotation = 0; // Holds value for rotation along the y-axis. + float zHeadRotation; + float yHeadRotation; const float MAXZROTATION = (3f * Mathf.PI) / 2f; const float MINZROTATION = (Mathf.PI) / 4f; float newXRotation; @@ -203,19 +202,23 @@ void PlayerLean() if (Input.GetKeyDown("q")) { Debug.Log("Lean Left"); - transform.localEulerAngles = new Vector3(0f, 0f, zRotation); + + transform.Rotate(0f, Time.deltaTime * (1 / 4), 10f); + //transform.localEulerAngles = new Vector3(0f, 0f, zBodyRotation); // Leans the "body" (a.k.a the capsule) to the left 10 degrees. + //Camera.transform.localEulerAngles = new Vector3(0f, 0f, zRotation); // Leans the "head" (a.k.a the camera) to simulate head peeking while leaning. // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } if (Input.GetKeyUp("q")) { Debug.Log("Upright position"); - transform.localEulerAngles = new Vector3(0f, 0f, 0f); + transform.Rotate(0f, 0f, -10f); + //transform.localEulerAngles = new Vector3(0f, 0f, 0f); // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } if (Input.GetKeyDown("e")) { Debug.Log("Lean Right"); - transform.localEulerAngles = new Vector3(0f, 0f, -zRotation); + transform.localEulerAngles = new Vector3(0f, 0f, -zBodyRotation); // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } if (Input.GetKeyUp("e")) diff --git a/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity b/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity index 81cf930ec440d38680cc152fd86e935c056ac2ed..bdeb264a72dcc799a8d69d64623393602c74caee 100644 GIT binary patch delta 1758 zcmaKsUr5tY6vyvRf38(qt~AOB8zg2pNJ~s8-TaGl{+YVeg^&_bf!gv<8EE_Y)B>T| z)u1q_=)nhr#V^8_Na@9T3!;3f3#KpLFgb3gaod(OG{oZrk-ZERk1 z2vKugh>kHK#7^k=Y}Wig+f7}U(El1rMITZ})u=WB}j;^6N+T7mpg zc`97t>%|H9B?-}kL5EZ_3xS0&Pk~f1TLOz=Zh|QgQ z1ykpV`L#@#heZxfpXANjIuvtYF0d_-BxbA3tYFE^oQQ(#wnB7fez0-Ow?R^vErTh? z9|CE)SQ2eGd=&oUQGaB(1UP}k?T}B*hTyRla~oud*#cMr=61+uW)y{TQk`0yk0lWT zyMvK##>>os$c8cB0jUWyi~=ghK4v+H!VjZVNG-D=Fy*+8SqzL0q-UyUmWOCPm^&cD z_BVwXL#Z zWv~e56kzw`wN?xwgsc!uIBwX(a1~Gm)5|P^6jU%5nJt2;U_#6sh*kyTwmj@4CkB|R zEf2H3yApP#mhie^1ki;IRB&Z%ILnL*uAJF2Gb*?WbzoYe;QCtaeOMAPFy*+PS#^5C z#{jdT3WjvxAj4^9s!`rG2T z5O5a54PE^V8EsCNi>(DR>eY4HAb++@OHV*IW4`m6%xkd7%(`r8YqR=QQ_)`4bfl}M zBwaNv>8hzo$GeG^3td+(^qzB;clLDkbvpCqR8xgcpMzVqIdGps=WMRZlfg24exwmh z--=P-vm-QlFL*4zUA_&vWM06kQ`yP<`aHSPXf;+IUX n6!Y42+O+;+`hWF}??-Q^-tUNMYl~=_CMSdaI+d`rop$~K`$kJ? delta 989 zcmXw%O=uHA6vyAxO}c7hQ(CnZm8dla8$n^|O$>-)^HDc#+SF1t2f-dv8{5VYXx-+f zAkuae^e9B}pb%LPJp@f}RS+r&dhnwP9=t_FTJWI%N!~2H{P+Fl&HUe+&Fv-e^o8&f z^^6k@hl!{K?{m-n!4CKOu9IH3yW_aw{yns|-F>w$FWg7L%fhwx<7ZpwherhE?-K*g za^cnv>?CR+%0mpqYi8HLO2|EkH_SpCh;qoih|j6kE(qNRD?ruWFU$f+?jmnQd}X!> z7DsL(R_n|m6Q^4M8xh~QFaoAcPBkArf+Z?}J%B2c9%eSWm`1({5oNXlrj29FM$v_h zn$3tfvqdnAoVsy>VHHpvsHW>>mP5M{C6^1tf=aJ)oOjnr&P*D3M(i43s@5D^^addZso9ewF Date: Sat, 20 May 2017 23:40:17 -0700 Subject: [PATCH 3/6] Update 5/20/2017 Another Update working on PlayerClass.cs --- .../CSClub 2017/Assets/Scripts/ButtonEvent.cs.meta | 12 ++++++++++++ .../CSClub 2017/Assets/Scripts/GameManager.cs.meta | 12 ++++++++++++ .../CSClub 2017/Assets/Scripts/GameSettings.cs.meta | 12 ++++++++++++ .../Assets/Scripts/SettingsManager.cs.meta | 12 ++++++++++++ CSClub2017/CSClub 2017/Assets/UI.meta | 9 +++++++++ 5 files changed, 57 insertions(+) create mode 100644 CSClub2017/CSClub 2017/Assets/Scripts/ButtonEvent.cs.meta create mode 100644 CSClub2017/CSClub 2017/Assets/Scripts/GameManager.cs.meta create mode 100644 CSClub2017/CSClub 2017/Assets/Scripts/GameSettings.cs.meta create mode 100644 CSClub2017/CSClub 2017/Assets/Scripts/SettingsManager.cs.meta create mode 100644 CSClub2017/CSClub 2017/Assets/UI.meta diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/ButtonEvent.cs.meta b/CSClub2017/CSClub 2017/Assets/Scripts/ButtonEvent.cs.meta new file mode 100644 index 0000000..c7d2433 --- /dev/null +++ b/CSClub2017/CSClub 2017/Assets/Scripts/ButtonEvent.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0603b49419bf874eab3d7a08240ddea +timeCreated: 1495257395 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/GameManager.cs.meta b/CSClub2017/CSClub 2017/Assets/Scripts/GameManager.cs.meta new file mode 100644 index 0000000..c4a21d1 --- /dev/null +++ b/CSClub2017/CSClub 2017/Assets/Scripts/GameManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 15ccfeba95110ec4aae11783c5186092 +timeCreated: 1495257395 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/GameSettings.cs.meta b/CSClub2017/CSClub 2017/Assets/Scripts/GameSettings.cs.meta new file mode 100644 index 0000000..de85819 --- /dev/null +++ b/CSClub2017/CSClub 2017/Assets/Scripts/GameSettings.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8ba071a23849261429c48bb8e355e535 +timeCreated: 1495257395 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/SettingsManager.cs.meta b/CSClub2017/CSClub 2017/Assets/Scripts/SettingsManager.cs.meta new file mode 100644 index 0000000..cbd674e --- /dev/null +++ b/CSClub2017/CSClub 2017/Assets/Scripts/SettingsManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 84bd3fb6671cd1c47925f7d8cc703f81 +timeCreated: 1495257395 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/CSClub2017/CSClub 2017/Assets/UI.meta b/CSClub2017/CSClub 2017/Assets/UI.meta new file mode 100644 index 0000000..70a2e88 --- /dev/null +++ b/CSClub2017/CSClub 2017/Assets/UI.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c06cec6e272de244fb9eb9ee638a4200 +folderAsset: yes +timeCreated: 1495257393 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: From a1e7ca209c241ce24ffcee87f7e4d29ec344f98b Mon Sep 17 00:00:00 2001 From: Spencer Wilson Date: Sat, 27 May 2017 23:05:28 -0700 Subject: [PATCH 4/6] Functional Leaning Mechanic This is the leaning mechanic as it it. It is functional in it's current state. I will move on to the crouching and the prone methods in order to get functional prototypes of those running as well. --- .../Assets/Scripts/PlayerControl.cs | 35 ++++++------------ .../Assets/_Scenes/Spencer_Test.unity | Bin 24716 -> 25204 bytes 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs index 42c79ee..d3fcca7 100755 --- a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs +++ b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs @@ -17,6 +17,9 @@ public class PlayerControl : MonoBehaviour { + public GameObject pivotPoint; // Public GameObject pivotPoint holds the point of which the player rotates around when leaning. + float upRightPos; // Holds the upright position for the Player. + public float speed = 3; // Declaring a variable that holds the player's speed. private Rigidbody rb; // Declaring a Rigidbody variable. private Text player_ui_text; @@ -208,42 +211,28 @@ void PlayerCrouch() void PlayerLean() { - float zBodyRotation = 10f; // Holds value for rotation along the z-axis. - float yBodyRotation = 0; // Holds value for rotation along the y-axis. - float zHeadRotation; - float yHeadRotation; - const float MAXZROTATION = (3f * Mathf.PI) / 2f; - const float MINZROTATION = (Mathf.PI) / 4f; - float newXRotation; - - if (Input.GetKeyDown("q")) + + if (Input.GetKeyDown("q")) // Leans player to the left when 'q' is pressed down on the keyboard. { Debug.Log("Lean Left"); - - transform.Rotate(0f, Time.deltaTime * (1 / 4), 10f); - //transform.localEulerAngles = new Vector3(0f, 0f, zBodyRotation); // Leans the "body" (a.k.a the capsule) to the left 10 degrees. - //Camera.transform.localEulerAngles = new Vector3(0f, 0f, zRotation); // Leans the "head" (a.k.a the camera) to simulate head peeking while leaning. - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + transform.Rotate(0f, 0f, 10f); } - if (Input.GetKeyUp("q")) + if (Input.GetKeyUp("q")) // Reorients player upon releasing 'q' to a upright position. { Debug.Log("Upright position"); transform.Rotate(0f, 0f, -10f); - //transform.localEulerAngles = new Vector3(0f, 0f, 0f); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } - if (Input.GetKeyDown("e")) + if (Input.GetKeyDown("e")) // Leans player to the right when 'e' is pressed down on the keyboard. { Debug.Log("Lean Right"); - transform.localEulerAngles = new Vector3(0f, 0f, -zBodyRotation); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + transform.Rotate(0f, 0f, -10f); } if (Input.GetKeyUp("e")) { - Debug.Log("Upright position"); - transform.localEulerAngles = new Vector3(0f, 0f, 0f); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + Debug.Log("Upright position"); // Reorients player upon releasing 'e' to a upright position. + transform.Rotate(0f, 0f, 10f); } + } void PlayerProne() diff --git a/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity b/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity index bdeb264a72dcc799a8d69d64623393602c74caee..0f58c9d1181f41c1dff91ef1c9b6bd20c7313b62 100644 GIT binary patch delta 1519 zcmZ9MPe@d85Xa}O|F&{JI))_|gCP8|*)-xA|u?IPDi$-=VS4V^9{2Y{Xd;u;;ADRbfJ6Ha`N*RE>UP z{R8Dw8Bms;r%v!GEmOU8XQ^pVRAO3bb9>9ht2bJ%8HLo<*4Jt1ooyY4N-da5(siRd zKdr{!e7&W+kUXue2C!>_pmLVwhZg`0~L<_GJ79R)q_>%c1} zT2$3uS3y}s*y9z?4A?XxqM`G*?;PZ4KhpJL<*c8Ct*A+_D=>znR&JWz+H%jP;iHBAQ^MhHHDuqpejUa|!QI)WCv{FPAASd9U<7*BU@&gWGoFspD-m>r$rIhuv97??1~09XrFuF+%!w%`h&)#1$-oAn&%M`ukyb6pZUO@?+=`Sacv<#1Pgcj1%?>n-Io@`-Clk zjlmU8XH%6mF)7>k6@D{F-~JL1seIkT|BUasdS300Y}gFES8EM!Wi+`% q6BTuKTpZK6R@#sFkhmVu!qcg+EeVIcl(}sF6+wS-ut;f?>YB+{rkz7Su#wb zfd@n*Gep#Y@v}E(ce}s;+lh%|j&pG#`r>==`jaz9vARNqYwf+R>gPmGKusTSv|FHV z#BKyP13$bP#+ZE%BbxR&#_W3;(X4)Wm&sGslV9qD_Eap+UKA$}g(mT-7M)?#0 zZ1-5cHpD){nqgZIF0qoB2UaC^2x<8{FTyPrhvhJ@MO2FwVaPjFF8#-#FNiftVt2Vv zS`%A`J;K^n#80slGDb1qhFBL{hP7c{hxjE%D&6n1E!4s{&xb!>A3BMSOw=-oemi17 zY!;?7MZ^L~8^<^Gh^SZ!rZZg-%fom-{zJsXT2WpnkxeFWvhM3CbYuai&~q_UVkMYP zJS~>NIXE%?56BiPl}%mBE;8?QGK=*Ysc zbTK!@N-$l_s8|Lk(8b&mTZQRjEHM++>SDq*b5}TrV*~YT>J)6+QTeb-ECXxCFYpWN z7MmC27j{mpD8?_WNAKsWys)uE-58cA597Q;d=0k+`*&87jEkkjc*6;?S7My_j@T+J yhdDpvyJFU^!k>ZnuEPD;X^&dDbh*%)h#Q8XvdM^YqHYyW))syz?|D@+X8r^B*R~M= From b72ae5c25a35bf2e52c18da24d3dccec72c55fa0 Mon Sep 17 00:00:00 2001 From: Spencer Wilson Date: Sat, 27 May 2017 23:10:01 -0700 Subject: [PATCH 5/6] Revert "Functional Leaning Mechanic" This reverts commit a1e7ca209c241ce24ffcee87f7e4d29ec344f98b. --- .../Assets/Scripts/PlayerControl.cs | 35 ++++++++++++------ .../Assets/_Scenes/Spencer_Test.unity | Bin 25204 -> 24716 bytes 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs index d3fcca7..42c79ee 100755 --- a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs +++ b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs @@ -17,9 +17,6 @@ public class PlayerControl : MonoBehaviour { - public GameObject pivotPoint; // Public GameObject pivotPoint holds the point of which the player rotates around when leaning. - float upRightPos; // Holds the upright position for the Player. - public float speed = 3; // Declaring a variable that holds the player's speed. private Rigidbody rb; // Declaring a Rigidbody variable. private Text player_ui_text; @@ -211,28 +208,42 @@ void PlayerCrouch() void PlayerLean() { - - if (Input.GetKeyDown("q")) // Leans player to the left when 'q' is pressed down on the keyboard. + float zBodyRotation = 10f; // Holds value for rotation along the z-axis. + float yBodyRotation = 0; // Holds value for rotation along the y-axis. + float zHeadRotation; + float yHeadRotation; + const float MAXZROTATION = (3f * Mathf.PI) / 2f; + const float MINZROTATION = (Mathf.PI) / 4f; + float newXRotation; + + if (Input.GetKeyDown("q")) { Debug.Log("Lean Left"); - transform.Rotate(0f, 0f, 10f); + + transform.Rotate(0f, Time.deltaTime * (1 / 4), 10f); + //transform.localEulerAngles = new Vector3(0f, 0f, zBodyRotation); // Leans the "body" (a.k.a the capsule) to the left 10 degrees. + //Camera.transform.localEulerAngles = new Vector3(0f, 0f, zRotation); // Leans the "head" (a.k.a the camera) to simulate head peeking while leaning. + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } - if (Input.GetKeyUp("q")) // Reorients player upon releasing 'q' to a upright position. + if (Input.GetKeyUp("q")) { Debug.Log("Upright position"); transform.Rotate(0f, 0f, -10f); + //transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } - if (Input.GetKeyDown("e")) // Leans player to the right when 'e' is pressed down on the keyboard. + if (Input.GetKeyDown("e")) { Debug.Log("Lean Right"); - transform.Rotate(0f, 0f, -10f); + transform.localEulerAngles = new Vector3(0f, 0f, -zBodyRotation); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } if (Input.GetKeyUp("e")) { - Debug.Log("Upright position"); // Reorients player upon releasing 'e' to a upright position. - transform.Rotate(0f, 0f, 10f); + Debug.Log("Upright position"); + transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. } - } void PlayerProne() diff --git a/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity b/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity index 0f58c9d1181f41c1dff91ef1c9b6bd20c7313b62..bdeb264a72dcc799a8d69d64623393602c74caee 100644 GIT binary patch delta 1253 zcmYk*Ur5tY6bJD0o6|PS{Ml;S|342knu&n~Ri=GGV?ZS#sFkhmVu!qcg+EeVIcl(}sF6+wS-ut;f?>YB+{rkz7Su#wb zfd@n*Gep#Y@v}E(ce}s;+lh%|j&pG#`r>==`jaz9vARNqYwf+R>gPmGKusTSv|FHV z#BKyP13$bP#+ZE%BbxR&#_W3;(X4)Wm&sGslV9qD_Eap+UKA$}g(mT-7M)?#0 zZ1-5cHpD){nqgZIF0qoB2UaC^2x<8{FTyPrhvhJ@MO2FwVaPjFF8#-#FNiftVt2Vv zS`%A`J;K^n#80slGDb1qhFBL{hP7c{hxjE%D&6n1E!4s{&xb!>A3BMSOw=-oemi17 zY!;?7MZ^L~8^<^Gh^SZ!rZZg-%fom-{zJsXT2WpnkxeFWvhM3CbYuai&~q_UVkMYP zJS~>NIXE%?56BiPl}%mBE;8?QGK=*Ysc zbTK!@N-$l_s8|Lk(8b&mTZQRjEHM++>SDq*b5}TrV*~YT>J)6+QTeb-ECXxCFYpWN z7MmC27j{mpD8?_WNAKsWys)uE-58cA597Q;d=0k+`*&87jEkkjc*6;?S7My_j@T+J yhdDpvyJFU^!k>ZnuEPD;X^&dDbh*%)h#Q8XvdM^YqHYyW))syz?|D@+X8r^B*R~M= delta 1519 zcmZ9MPe@d85Xa}O|F&{JI))_|gCP8|*)-xA|u?IPDi$-=VS4V^9{2Y{Xd;u;;ADRbfJ6Ha`N*RE>UP z{R8Dw8Bms;r%v!GEmOU8XQ^pVRAO3bb9>9ht2bJ%8HLo<*4Jt1ooyY4N-da5(siRd zKdr{!e7&W+kUXue2C!>_pmLVwhZg`0~L<_GJ79R)q_>%c1} zT2$3uS3y}s*y9z?4A?XxqM`G*?;PZ4KhpJL<*c8Ct*A+_D=>znR&JWz+H%jP;iHBAQ^MhHHDuqpejUa|!QI)WCv{FPAASd9U<7*BU@&gWGoFspD-m>r$rIhuv97??1~09XrFuF+%!w%`h&)#1$-oAn&%M`ukyb6pZUO@?+=`Sacv<#1Pgcj1%?>n-Io@`-Clk zjlmU8XH%6mF)7>k6@D{F-~JL1seIkT|BUasdS300Y}gFES8EM!Wi+`% q6BTuKTpZK6R@ Date: Wed, 31 May 2017 19:11:07 -0700 Subject: [PATCH 6/6] Leaning Mechanics Update 0.1 Update to the current leaning mechanics. --- .../Assets/Scripts/PlayerControl.cs | 395 ++++++++++-------- .../Assets/_Scenes/Spencer_Test.unity | Bin 24716 -> 25204 bytes .../ProjectSettings/ProjectVersion.txt | 2 +- 3 files changed, 222 insertions(+), 175 deletions(-) diff --git a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs index 42c79ee..72c7dbd 100755 --- a/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs +++ b/CSClub2017/CSClub 2017/Assets/Scripts/PlayerControl.cs @@ -1,7 +1,7 @@ /* * * Author: Spencer Wilson - * Date: 5/6/2017, 11:28 pm + * Date: 5/31/2017, 7:10 pm * File: PlayerControl.cs * Description: This file contains the code that takes user input in order to control the character. * @@ -17,134 +17,138 @@ public class PlayerControl : MonoBehaviour { - public float speed = 3; // Declaring a variable that holds the player's speed. - private Rigidbody rb; // Declaring a Rigidbody variable. + public float speed = 3; // Declaring a variable that holds the player's speed. + private Rigidbody rb; // Declaring a Rigidbody variable. + public GameObject pivotCen; // Area that the player rotates around when leaning. private Text player_ui_text; - float xRotationV = 0.0f; // The velocity along the x-axis. SmoothDamp function requires you to have a saved velocity variable. - float yRotationV = 0.0f; // The velocity along the y-axis. SmoothDamp function requires you to have a saved velocity variable. - float yRotation; // Variable that holds the value that the character rotates along the y-axis. (Where the player turns too) - float xRotation; // Variable that holds the value that the character rotates along the x-axis. (Where the player turns too) - public float currentRotationX; // Variable that holds the current value of the XRotation, prior to the camera movement. - public float currentRotationY; // Variable that holds the current value of the YRotation, priotr to the camera movement. - public float lookSmoothDamp = 0.1f; // Controls the smoothness of the player's look. (controls how smooth or jarring the camera is) - public float lookSensitivityX = 5.0f; // Variable that controls the sensitivity of the horizontal look. - public float lookSensitivityY = 5.0f; // Variable that controls the sensitivty of the vertical look. - public int maxVertical = 90; // Controls the maximum value along the vertical axis that the player can look. - public int minVertical = -90; // Controls the minimum value along the vertical axis that the player can look. - - public Camera mainCamera; - public Light flashlight; + float xRotationV = 0.0f; // The velocity along the x-axis. SmoothDamp function requires you to have a saved velocity variable. + float yRotationV = 0.0f; // The velocity along the y-axis. SmoothDamp function requires you to have a saved velocity variable. + float yRotation; // Variable that holds the value that the character rotates along the y-axis. (Where the player turns too) + float xRotation; // Variable that holds the value that the character rotates along the x-axis. (Where the player turns too) + public float currentRotationX; // Variable that holds the current value of the XRotation, prior to the camera movement. + public float currentRotationY; // Variable that holds the current value of the YRotation, priotr to the camera movement. + public float lookSmoothDamp = 0.1f; // Controls the smoothness of the player's look. (controls how smooth or jarring the camera is) + public float lookSensitivityX = 5.0f; // Variable that controls the sensitivity of the horizontal look. + public float lookSensitivityY = 5.0f; // Variable that controls the sensitivty of the vertical look. + public int maxVertical = 90; // Controls the maximum value along the vertical axis that the player can look. + public int minVertical = -90; // Controls the minimum value along the vertical axis that the player can look. + + public Camera mainCamera; + public Light flashlight; public Shader EffectsShader; - private bool lightOn = false; - private bool mouseBound = true; + private bool lightOn = false; + private bool mouseBound = true; private bool lookEnabled = true; private bool moveEnabled = true; private bool isHiding = false; private float currentTimeScale; - void Start() - { - Cursor.lockState = CursorLockMode.Locked; - Cursor.visible = !mouseBound; - rb = GetComponent(); + void Start() + { + + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = !mouseBound; + rb = GetComponent(); this.player_ui_text = GetComponentInChildren().GetComponentInChildren(); currentTimeScale = Time.timeScale; - if(mainCamera != null && EffectsShader != null) + if (mainCamera != null && EffectsShader != null) { Debug.Log("Loading Custom Shaders"); mainCamera.SetReplacementShader(EffectsShader, ""); } - } + } - private void Update() - { - if (Input.GetKeyDown(KeyCode.F)) { - lightOn = !lightOn; - } - flashlight.enabled = lightOn; - } + private void Update() + { + if (Input.GetKeyDown(KeyCode.F)) + { + lightOn = !lightOn; + } + flashlight.enabled = lightOn; + } - // Update is called once per frame - void FixedUpdate() // Used a tutorial, hopefully going to be expanding on this method to suit the game's needs and functionalities. - { - PlayerRotation(); // Calls upon the PlayerRotation() function. - PlayerRun(); // Calls upon the PlayerRun() function. - PlayerMovement(); // Calls upon the PlayerMovement() function. - //PlayerCrouch(); // Calls upon the PlayerCrouch() function. - PlayerLean(); // Calls upon the PlayerLean() function. - //PlayerProne(); // Calls upon the PlayerProne() function. - PlayerPause(); - } + // Update is called once per frame + void FixedUpdate() // Used a tutorial, hopefully going to be expanding on this method to suit the game's needs and functionalities. + { + PlayerRotation(); // Calls upon the PlayerRotation() function. + PlayerRun(); // Calls upon the PlayerRun() function. + PlayerMovement(); // Calls upon the PlayerMovement() function. + //PlayerCrouch(); // Calls upon the PlayerCrouch() function. + PlayerLean(); // Calls upon the PlayerLean() function. + PlayerProne(); // Calls upon the PlayerProne() function. + PlayerPause(); + } - void PlayerMovement() - { + void PlayerMovement() + { if (!this.moveEnabled) return; - float xAxis = Input.GetAxis("Horizontal"); // Declaring xAxis and assigning the Player's position along the x-axis to it. (My guess) - float zAxis = Input.GetAxis("Vertical"); // Declaring zAxis and assigning the Player's position along the z-axis to it. (My guess) - //Debug.Log( "x: " + xAxis + " z: " + zAxis); - - //Converting EularAngles to Radians, Adding 90 degrees for Left Right Radian converting - float radians = (mainCamera.transform.rotation.eulerAngles.y * Mathf.PI) / 180f ; - float radiansLR = ((mainCamera.transform.rotation.eulerAngles.y + 90) * Mathf.PI) / 180f ; - - //Mathf uses Radians only! - float modCos = Mathf.Cos (radians); - float modSin = Mathf.Sin (radians); - - float modCosLR = Mathf.Cos (radiansLR); - float modSinLR = Mathf.Sin (radiansLR); - - float newXDirec = zAxis * modSin + xAxis * modSinLR; - float newZDirec = zAxis * modCos + xAxis * modCosLR; - - //Debug.Log( "x: " + modCos + " z: " + modSin + " Cam: " + mainCamera.transform.rotation.eulerAngles.y - // + " Cam2: " + radians + " Pos: " + transform.position.x + " " + transform.position.z); - - //Debug.Log( "x: " + newXDirec + " z: " + newZDirec); - //Debug.Log( "Cam Rot: " + mainCamera.transform.rotation.eulerAngles.y); - - Vector3 movement = new Vector3(newXDirec, 0f, newZDirec) * speed * Time.deltaTime; - - //Assigning the player's movement to the movement variable. (My guess) - - //transform.position += transform.forward * xAxis + transform.forward * zAxis; Another way to make the player move, expect it doesn't allow the player to strafe sideways left and right. - - rb.MovePosition(transform.position + movement); // Adding player's input movement to the new position, allowing the player to move. (My guess) - } - - - - void PlayerRotation() - { + float xAxis = Input.GetAxis("Horizontal"); // Declaring xAxis and assigning the Player's position along the x-axis to it. (My guess) + float zAxis = Input.GetAxis("Vertical"); // Declaring zAxis and assigning the Player's position along the z-axis to it. (My guess) + //Debug.Log( "x: " + xAxis + " z: " + zAxis); + + //Converting EularAngles to Radians, Adding 90 degrees for Left Right Radian converting + float radians = (mainCamera.transform.rotation.eulerAngles.y * Mathf.PI) / 180f; + float radiansLR = ((mainCamera.transform.rotation.eulerAngles.y + 90) * Mathf.PI) / 180f; + + //Mathf uses Radians only! + float modCos = Mathf.Cos(radians); + float modSin = Mathf.Sin(radians); + + float modCosLR = Mathf.Cos(radiansLR); + float modSinLR = Mathf.Sin(radiansLR); + + float newXDirec = zAxis * modSin + xAxis * modSinLR; + float newZDirec = zAxis * modCos + xAxis * modCosLR; + + //Debug.Log( "x: " + modCos + " z: " + modSin + " Cam: " + mainCamera.transform.rotation.eulerAngles.y + // + " Cam2: " + radians + " Pos: " + transform.position.x + " " + transform.position.z); + + //Debug.Log( "x: " + newXDirec + " z: " + newZDirec); + //Debug.Log( "Cam Rot: " + mainCamera.transform.rotation.eulerAngles.y); + + Vector3 movement = new Vector3(newXDirec, 0f, newZDirec) * speed * Time.deltaTime; + + //Assigning the player's movement to the movement variable. (My guess) + + //transform.position += transform.forward * xAxis + transform.forward * zAxis; Another way to make the player move, expect it doesn't allow the player to strafe sideways left and right. + + rb.MovePosition(transform.position + movement); // Adding player's input movement to the new position, allowing the player to move. (My guess) + } + + + + void PlayerRotation() + { if (!this.lookEnabled) return; - xRotation += 0 - (Input.GetAxis("Mouse Y") * lookSensitivityY); // Stores the mouse's input along the y-axis (like a hinge, rotating left and right) and multiplying it to the lookSensitivity to get the value for the xRotation. Subtracting from zero corrects the axis from being inversed. - yRotation -= 0 - (Input.GetAxis("Mouse X") * lookSensitivityX); // Stores the mouse's input along the x-axis (like a hinge, rotating up and down) and multiplies it to the lookSensitivity to get the value for the yRotation. Subtracting from zero corrects the axis from being inversed. - - xRotation = Mathf.Clamp(xRotation, minVertical, maxVertical); // Makes sure the character has a realistic range of vertical head movement, clapms between minimumn and maximum. (Look Variable, minimum look, maximum look) - - currentRotationX = Mathf.SmoothDamp(currentRotationX, xRotation, ref xRotationV, lookSmoothDamp); // Gets the new x rotation on the x-axis by accounting for all of the variables that affect it's movement. - currentRotationY = Mathf.SmoothDamp(currentRotationY, yRotation, ref yRotationV, lookSmoothDamp); // Gets the new y rotation on the y-axis by accounting for all of the variables that affect it's movement. - - mainCamera.transform.rotation = Quaternion.Euler(currentRotationX, currentRotationY, 0); // Transforms from the previous rotations to the new rotations. - } - - void PlayerPause() - { - if (Input.GetButtonDown("Cancel")) - { - mouseBound = !mouseBound; - Debug.Log("Escape " + mouseBound); - if(mouseBound) - { + xRotation += 0 - (Input.GetAxis("Mouse Y") * lookSensitivityY); // Stores the mouse's input along the y-axis (like a hinge, rotating left and right) and multiplying it to the lookSensitivity to get the value for the xRotation. Subtracting from zero corrects the axis from being inversed. + yRotation -= 0 - (Input.GetAxis("Mouse X") * lookSensitivityX); // Stores the mouse's input along the x-axis (like a hinge, rotating up and down) and multiplies it to the lookSensitivity to get the value for the yRotation. Subtracting from zero corrects the axis from being inversed. + + xRotation = Mathf.Clamp(xRotation, minVertical, maxVertical); // Makes sure the character has a realistic range of vertical head movement, clapms between minimumn and maximum. (Look Variable, minimum look, maximum look) + + currentRotationX = Mathf.SmoothDamp(currentRotationX, xRotation, ref xRotationV, lookSmoothDamp); // Gets the new x rotation on the x-axis by accounting for all of the variables that affect it's movement. + currentRotationY = Mathf.SmoothDamp(currentRotationY, yRotation, ref yRotationV, lookSmoothDamp); // Gets the new y rotation on the y-axis by accounting for all of the variables that affect it's movement. + + mainCamera.transform.rotation = Quaternion.Euler(currentRotationX, currentRotationY, 0f); // Transforms from the previous rotations to the new rotations. + pivotCen.transform.rotation = Quaternion.Euler(0f, currentRotationY, 0f); // Rotates the Pivot Point gameobject in an attepmt to tie the new rotation with the z rotation in PlayerLean(). + } + + void PlayerPause() + { + if (Input.GetButtonDown("Cancel")) + { + mouseBound = !mouseBound; + Debug.Log("Escape " + mouseBound); + if (mouseBound) + { //In gameplay Cursor.lockState = CursorLockMode.Locked; Cursor.visible = !mouseBound; @@ -153,103 +157,146 @@ void PlayerPause() UI_Clear_Text(); //Time.timeScale = currentTimeScale; } - else - { + else + { //In menu Cursor.lockState = CursorLockMode.None; - Cursor.visible = !mouseBound; + Cursor.visible = !mouseBound; this.LookDisable(); this.MoveDisable(); UI_Set_Text("Menu Mode"); //Time.timeScale = 0.001f; } - } - - } + } + } - void PlayerRun() // Creating a function that get's input in order to run. - { - if (Input.GetKey("left shift")) // When user presses down on the left shift, speed is set to 8. - { - speed = 8; - } - if (Input.GetKeyUp("left shift")) // When user lets go of the left shift, speed is set to 3. - { - speed = 3; - } - if (Input.GetKey("right shift")) // When user presses down on the right shift, speed is set to 8. - { - speed = 8; - } - if (Input.GetKeyUp("right shift")) // When user lets go of the right shift, speed is set to 3. - { - speed = 3; - } - } + void PlayerRun() // Creating a function that get's input in order to run. + { + if (Input.GetKey("left shift")) // When user presses down on the left shift, speed is set to 8. + { + speed = 8; + } + if (Input.GetKeyUp("left shift")) // When user lets go of the left shift, speed is set to 3. + { + speed = 3; + } + if (Input.GetKey("right shift")) // When user presses down on the right shift, speed is set to 8. + { + speed = 8; + } + if (Input.GetKeyUp("right shift")) // When user lets go of the right shift, speed is set to 3. + { + speed = 3; + } + } - void PlayerCrouch() - { - if (Input.GetKeyDown("x")) - { - // Insert crouch code here - } - if (Input.GetKeyUp("x")) - { - // Insert standing up code here - } - } + void PlayerCrouch() + { + if (Input.GetKeyDown("x")) + { + // Insert crouch code here + } + + if (Input.GetKeyUp("x")) + { + // Insert standing up code here + } + } void PlayerLean() { - float zBodyRotation = 10f; // Holds value for rotation along the z-axis. - float yBodyRotation = 0; // Holds value for rotation along the y-axis. - float zHeadRotation; - float yHeadRotation; - const float MAXZROTATION = (3f * Mathf.PI) / 2f; - const float MINZROTATION = (Mathf.PI) / 4f; - float newXRotation; - - if (Input.GetKeyDown("q")) - { - Debug.Log("Lean Left"); - - transform.Rotate(0f, Time.deltaTime * (1 / 4), 10f); - //transform.localEulerAngles = new Vector3(0f, 0f, zBodyRotation); // Leans the "body" (a.k.a the capsule) to the left 10 degrees. - //Camera.transform.localEulerAngles = new Vector3(0f, 0f, zRotation); // Leans the "head" (a.k.a the camera) to simulate head peeking while leaning. - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. - } - if (Input.GetKeyUp("q")) + //float zBodyRotation = 10f; // Holds value for rotation along the z-axis. + //float yBodyRotation = 0; // Holds value for rotation along the y-axis. + //float zHeadRotation; + //float yHeadRotation; + //const float MAXZROTATION = (3f * Mathf.PI) / 2f; + //const float MINZROTATION = (Mathf.PI) / 4f; + //float newXRotation; + + Transform objTransform = pivotCen.GetComponent(); + Vector3 pivotPointPos = objTransform.position; + + bool heldQ = Input.GetKey("q"); + bool heldE = Input.GetKey("e"); + + float currentRotationAng = rb.rotation.eulerAngles.z; + const float MINANGLE = -45; + const float MAXANGLE = 45; + float leanAngle = 10f; + + if (heldQ == true) { - Debug.Log("Upright position"); - transform.Rotate(0f, 0f, -10f); - //transform.localEulerAngles = new Vector3(0f, 0f, 0f); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //if ((currentRotationAng > 0) && (currentRotationAng < 90)) + //{ + Debug.Log("Player Lean Left"); + pivotCen.transform.Rotate(pivotPointPos, 70f); + transform.RotateAround(pivotPointPos, Vector3.forward, leanAngle); // Leans the player to the left. + //rb.freezeRotation; + //} } - if (Input.GetKeyDown("e")) + else if (heldE == true) { - Debug.Log("Lean Right"); - transform.localEulerAngles = new Vector3(0f, 0f, -zBodyRotation); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //if ((currentRotationAng < 0) && (currentRotationAng > -90)) + //{ + Debug.Log("Player Lean Right"); + transform.RotateAround(pivotPointPos, Vector3.forward, -leanAngle); // Leans the player to the right. + //} } - if (Input.GetKeyUp("e")) + else { - Debug.Log("Upright position"); - transform.localEulerAngles = new Vector3(0f, 0f, 0f); - // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + Debug.Log("Player is upright."); } + + //if (Input.GetKeyDown("q")) + //{ + // Debug.Log("Lean Left"); + + // transform.Rotate(0f, Time.deltaTime * (1 / 4), 10f); + // //transform.localEulerAngles = new Vector3(0f, 0f, zBodyRotation); // Leans the "body" (a.k.a the capsule) to the left 10 degrees. + // //Camera.transform.localEulerAngles = new Vector3(0f, 0f, zRotation); // Leans the "head" (a.k.a the camera) to simulate head peeking while leaning. + // // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //} + //if (Input.GetKeyUp("q")) + //{ + // Debug.Log("Upright position"); + // transform.Rotate(0f, 0f, -10f); + // //transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //} + //if (Input.GetKeyDown("e")) + //{ + // Debug.Log("Lean Right"); + // transform.localEulerAngles = new Vector3(0f, 0f, -zBodyRotation); + // // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //} + //if (Input.GetKeyUp("e")) + //{ + // Debug.Log("Upright position"); + // transform.localEulerAngles = new Vector3(0f, 0f, 0f); + // // Mathf.Clamp(zRotation, MINZROTATION, MAXZROTATION); // Clamps rotation between two values to give a realistic range of leaning. + //} } void PlayerProne() - { - // Insert Player Prone Stuff. Might have to call upon the PlayerMovement function here to change the value of speed so it is slower when crawling. - } + { + bool proneKey = Input.GetKey("c"); + + if (proneKey == true) + { + Debug.Log("Player is prone."); + } + else + { + Debug.Log("Player is standing."); + } + } /// /// True when the player is Hiding @@ -288,7 +335,7 @@ public void LookEnable() public void LookDisable() { this.lookEnabled = false; - } + } /// /// Enable Player move controls @@ -313,7 +360,7 @@ public void UI_Clear_Text() this.player_ui_text.text = ""; } } - + /******************************** @@ -323,7 +370,7 @@ public void UI_Clear_Text() public void UI_Set_Text(string input) { - if(this.player_ui_text != null) + if (this.player_ui_text != null) { this.player_ui_text.text = input; } diff --git a/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity b/CSClub2017/CSClub 2017/Assets/_Scenes/Spencer_Test.unity index bdeb264a72dcc799a8d69d64623393602c74caee..ac1d645da804d116ac7e2c66d4fb6c8958c59dbf 100644 GIT binary patch delta 1229 zcmZ9KO-NKx6vxjSCY}69YizW%vdGjFZ6FP8#+g!48?+~yT8nbbH;k3eFuv5HnpsA* zn7FkovQ|S_7_VKB^s%T#V9+93ge`(LfnW<4Vf~MDF9ROr zZR2Gt`Lgb+^-TJVpNLl=-c=2;ZQON`cWE`^c}acwWYjQ5N!QJoXMaa<+&DRM!8mWW zP;_i6VzwF+qSE`YG@b4X2S<%q3$=$rD49$zt#{sfhpmyUmG+NX#XWS}0-Y%Ey18>I zhlp7&6p+j>esnm!Nua}^`B1mad;q(N^(LrCG94H3V_gVc%m3U6M@ixCbjAy@Rh@l9 zW>R1}D)47fT(VU#)hQv_Aq*Ks4R?Co+;9|*X2F8+{3;8QISMj$=S`s-Yv2ErO|`qmntcWrp!(#h>u7Gy`~F zHt}brS)nsicucYcSS{+Zq2rRxOXdJ;m263}&0uZnydt8zSmQA%HkcoSqm%)t8c#~- z-=1k=N*0xj54T)nr<-u*+KOTFY^$ClaguLn0Z-v-DFnny`AE&V-ML zA!47FO$580c78xHH{iFH2l{Pg>N&ZRe?^^t?s7dcHer(R=k;L delta 932 zcmZ9~O-NKx6bJD0#IKne9W^J*R5U2TaWb+ADQ7fA#?eGX9U;gMnuzG*F>1Nc-fPuB z2E{F~MNoq1Mi_kVL*_Q+mVU-1EEl-E-f2^W&p2|G}sv ziasP7nHxUq2l1m?HMx!!Um$9hd< z2T)+0i(AX&*(!er%WjtvAK1_W3vL|A6RJ_J->JCLYTT zHT(Pp#>=F_4L+AorfXHmcetbum5~jD){)<-^o6k6sHo4IG~@BB>T~N$=TRt7Xf!+N zu1&+5#hM~Sw7B&&5wVcfT!`#F_Ef7XOXtj$j6;4`YgXu|OXtoWD5EO>Ee6 zWIjxrSVigHx^}T7%#Sq%h>K!x#R_2^`PS}++k!4&r{1uP=qYM^GfKof2_#CvbmK{} z$f3O^Q(`k>yx+9giWoP(E0!q->L&LD&2r~^^tW6692!*bhg{D1aGjxk4ZBt2#Bnv! dSEROLL6z#sT^||Dar~Fv1?tT}sftYa{{o0!k7)n^ diff --git a/CSClub2017/CSClub 2017/ProjectSettings/ProjectVersion.txt b/CSClub2017/CSClub 2017/ProjectSettings/ProjectVersion.txt index ca09a3d..6e4d03d 100644 --- a/CSClub2017/CSClub 2017/ProjectSettings/ProjectVersion.txt +++ b/CSClub2017/CSClub 2017/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 5.6.0f3 +m_EditorVersion: 5.6.1f1