From 214ad692f194e47bbbf80bfa32494ff5f8f700a9 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sun, 9 Feb 2020 18:40:13 -0500 Subject: [PATCH] Implemented ability for bean to change skins on the fly, now I just need to add the skins --- Assets/Materials/Bean Skins.meta | 8 ++++++++ Assets/Scenes/Floor Level.unity | 3 +++ Assets/Scenes/Hub World.unity | 13 ++++++++++++ Assets/Scenes/Infinity Runner.unity | 3 +++ Assets/Scenes/Waypoint Race.unity | 3 +++ Assets/Scripts/PlayerController.cs | 13 ++++++++++++ ProjectSettings/InputManager.asset | 32 +++++++++++++++++++++++++++++ 7 files changed, 75 insertions(+) create mode 100644 Assets/Materials/Bean Skins.meta diff --git a/Assets/Materials/Bean Skins.meta b/Assets/Materials/Bean Skins.meta new file mode 100644 index 0000000..a97f512 --- /dev/null +++ b/Assets/Materials/Bean Skins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3faab3b466c5d7408c786dbb828968b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Floor Level.unity b/Assets/Scenes/Floor Level.unity index d47023b..9e8c0dc 100644 --- a/Assets/Scenes/Floor Level.unity +++ b/Assets/Scenes/Floor Level.unity @@ -2576,6 +2576,9 @@ MonoBehaviour: playerModel: {fileID: 1573414419} jumpNoise: {fileID: 546058364} respawnNoise: {fileID: 1853924296} + characterSkins: + - {fileID: 2100000, guid: 8d5a324e1b6a0d44c875fdbd475e22b9, type: 2} + playerSkin: {fileID: 1573414419} respawnTime: 0 --- !u!143 &1644583841 CharacterController: diff --git a/Assets/Scenes/Hub World.unity b/Assets/Scenes/Hub World.unity index 0c08044..4704911 100644 --- a/Assets/Scenes/Hub World.unity +++ b/Assets/Scenes/Hub World.unity @@ -4164,6 +4164,19 @@ MonoBehaviour: playerModel: {fileID: 615882415} jumpNoise: {fileID: 519269293} respawnNoise: {fileID: 54133630} + characterSkins: + - {fileID: 2100000, guid: 8d5a324e1b6a0d44c875fdbd475e22b9, type: 2} + - {fileID: 2100000, guid: 5624862376087f240b50f6a8a373bb83, type: 2} + - {fileID: 2100000, guid: 62136a2b40b5e294795a56583a9451fa, type: 2} + - {fileID: 2100000, guid: 318947ba2b4d8af4fbbbcd0e339d1467, type: 2} + - {fileID: 2100000, guid: 7531da5f93efe9e4489bd58faa432824, type: 2} + - {fileID: 2100000, guid: 42806559a24f32a43aa4a2670138cf7b, type: 2} + - {fileID: 2100000, guid: 0d2b168cc172234409100319a562989d, type: 2} + - {fileID: 2100000, guid: 201b92e97dd24d1478e27c8d38c2e2b0, type: 2} + - {fileID: 2100000, guid: 627d162b6b756c94680ca7db5830f4ae, type: 2} + - {fileID: 2100000, guid: 727f61c75f8320d4ab79aaf01ab76181, type: 2} + - {fileID: 2100000, guid: 10a76516dc20d7740a965a52140b5c4c, type: 2} + playerSkin: {fileID: 615882415} respawnTime: 0 --- !u!143 &741217458 CharacterController: diff --git a/Assets/Scenes/Infinity Runner.unity b/Assets/Scenes/Infinity Runner.unity index 892ec2c..d8935dc 100644 --- a/Assets/Scenes/Infinity Runner.unity +++ b/Assets/Scenes/Infinity Runner.unity @@ -2922,6 +2922,9 @@ MonoBehaviour: playerModel: {fileID: 1179584401} jumpNoise: {fileID: 2115917840} respawnNoise: {fileID: 526425757} + characterSkins: + - {fileID: 2100000, guid: 8d5a324e1b6a0d44c875fdbd475e22b9, type: 2} + playerSkin: {fileID: 1179584401} respawnTime: 0 --- !u!143 &1885424380 CharacterController: diff --git a/Assets/Scenes/Waypoint Race.unity b/Assets/Scenes/Waypoint Race.unity index ed97ae8..b431d47 100644 --- a/Assets/Scenes/Waypoint Race.unity +++ b/Assets/Scenes/Waypoint Race.unity @@ -2671,6 +2671,9 @@ MonoBehaviour: playerModel: {fileID: 392444983} jumpNoise: {fileID: 1860511536} respawnNoise: {fileID: 1436563779} + characterSkins: + - {fileID: 2100000, guid: 8d5a324e1b6a0d44c875fdbd475e22b9, type: 2} + playerSkin: {fileID: 392444983} respawnTime: 0 --- !u!143 &1759649037 CharacterController: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 0f0c744..bfd2e6b 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -27,6 +27,9 @@ public class PlayerController : MonoBehaviour public GameObject playerModel; public AudioSource jumpNoise; public AudioSource respawnNoise; + public Material[] characterSkins; + public static int characterSelect = 0; + public GameObject playerSkin; private bool wallRunning = false; private bool diving = false; @@ -52,6 +55,7 @@ public class PlayerController : MonoBehaviour float halfSec = 0.5f; float quarterSec = 0.25f; float tenthSec = 0.1f; + MeshRenderer mr; void Start() { @@ -67,6 +71,9 @@ public class PlayerController : MonoBehaviour Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; + + mr = playerSkin.GetComponent(); + mr.material = characterSkins[characterSelect]; } void OnControllerColliderHit(ControllerColliderHit hit) @@ -274,6 +281,12 @@ public class PlayerController : MonoBehaviour } + if(Input.GetButtonDown("Character Swap")) + { + characterSelect = Random.Range(0, characterSkins.Length); + mr.material = characterSkins[characterSelect]; + } + if (Input.GetButtonDown("Jump") && jump <= 1) { moveDirection.y = jumpHeight; diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 70d4699..9a45e29 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -341,3 +341,35 @@ InputManager: type: 0 axis: 0 joyNum: 0 + - serializedVersion: 3 + m_Name: Character Swap + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Character Swap + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: f + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0