Implemented ability for bean to change skins on the fly, now I just need to add the skins

This commit is contained in:
Gregory Campbell
2020-02-09 18:40:13 -05:00
parent a728e7518a
commit 214ad692f1
7 changed files with 75 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d3faab3b466c5d7408c786dbb828968b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -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:
+13
View File
@@ -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:
+3
View File
@@ -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:
+3
View File
@@ -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:
+13
View File
@@ -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<MeshRenderer>();
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;