Added character selection in the main game scene and also changed the original stock scene into the modified scene

nuruz-dev
nuruznaeem198 5 months ago
parent a21a03e794
commit 1f5c7398e7

@ -1,3 +1,4 @@
using Animancer;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -12,6 +13,7 @@ public class CharactersScript : MonoBehaviour
public Button nextButton; public Button nextButton;
public Button prevButton; public Button prevButton;
public Button selectButton; // Separate "Select" button for current character public Button selectButton; // Separate "Select" button for current character
public Avatar[] characterAvatar;
void Start() void Start()
{ {
@ -76,7 +78,7 @@ public class CharactersScript : MonoBehaviour
{ {
character.SetActive(false); character.SetActive(false);
} }
characters[index].transform.parent.GetComponent<AnimancerComponent>().Animator.avatar = characterAvatar[index];
// Show the character at the specified index // Show the character at the specified index
if (index >= 0 && index < characters.Length) if (index >= 0 && index < characters.Length)
{ {
@ -97,10 +99,12 @@ public class CharactersScript : MonoBehaviour
{ {
selectButton.GetComponentInChildren<Text>().text = "Select"; selectButton.GetComponentInChildren<Text>().text = "Select";
} }
//characters[savedIndex].SetActive(true);
//characters[savedIndex].transform.parent.GetComponent<AnimancerComponent>().Animator.avatar = characterAvatar[savedIndex];
} }
public void playGame() public void playGame()
{ {
SceneManager.LoadScene("Level_1 New Enemies");
} }
} }

@ -21,16 +21,17 @@ public class NeutralsSpawn : Unit
private void Awake() private void Awake()
{ {
for (int i = 0; i < neutralMember.Length; i++)
{
neutralMember[i].gameObject.SetActive(false);
}
currentCamera = Camera.main; currentCamera = Camera.main;
index = PlayerPrefs.GetInt("selectedCharacterIndex"); index = PlayerPrefs.GetInt("selectedCharacterIndex");
} }
private void Start() private void Start()
{ {
for (int i = 0; i < neutralMember.Length; i++)
{
neutralMember[i].gameObject.SetActive(false);
}
neutralMember[index].gameObject.SetActive(true); neutralMember[index].gameObject.SetActive(true);
} }
private void Update() private void Update()

@ -14,7 +14,7 @@ public class ParticleController : MonoBehaviour
// Debug.Log("index is" + index); // Debug.Log("index is" + index);
enableprojectileParticles(index); enableprojectileParticles(index);
//enableimpactParticles(index); //enableimpactParticles(index);
enablemuzzleParticles(index); //enablemuzzleParticles(index);
} }
public void enableprojectileParticles(int val) public void enableprojectileParticles(int val)
{ {

@ -720,8 +720,8 @@ MonoBehaviour:
m_UiScaleMode: 0 m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100 m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1 m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600} m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0 m_ScreenMatchMode: 2
m_MatchWidthOrHeight: 0 m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3 m_PhysicalUnit: 3
m_FallbackScreenDPI: 96 m_FallbackScreenDPI: 96

@ -10457,7 +10457,7 @@ PrefabInstance:
- target: {fileID: 1032966837458598255, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3} - target: {fileID: 1032966837458598255, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3}
propertyPath: _manualSetupPools.Array.data[2] propertyPath: _manualSetupPools.Array.data[2]
value: value:
objectReference: {fileID: 0} objectReference: {fileID: 1912088910611789089}
- target: {fileID: 1279323786998748574, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3} - target: {fileID: 1279323786998748574, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 1.37 value: 1.37
@ -10990,6 +10990,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 8926135060756488905, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3} m_CorrespondingSourceObject: {fileID: 8926135060756488905, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3}
m_PrefabInstance: {fileID: 1912088910611789087} m_PrefabInstance: {fileID: 1912088910611789087}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &1912088910611789089 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4410584998766821575, guid: 2afb0c0b1e9834310869cb2f0c994844, type: 3}
m_PrefabInstance: {fileID: 1912088910611789087}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 365c902c6341b48759f45c20720f4d12, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &2341981267675357841 --- !u!4 &2341981267675357841
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

@ -122,6 +122,7 @@ Transform:
- {fileID: 6113939482121949253} - {fileID: 6113939482121949253}
- {fileID: 1118852334229254106} - {fileID: 1118852334229254106}
- {fileID: 3727631899977298623} - {fileID: 3727631899977298623}
- {fileID: 8439904960819944385}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &49188329263227556 --- !u!135 &49188329263227556
@ -226,6 +227,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
projectileParticles: projectileParticles:
- {fileID: 1118852334229578234} - {fileID: 1118852334229578234}
- {fileID: 8439904960820043571}
- {fileID: 3727631899976960989} - {fileID: 3727631899976960989}
impactParticles: [] impactParticles: []
muzzleParticles: [] muzzleParticles: []
@ -525,3 +527,90 @@ Transform:
m_CorrespondingSourceObject: {fileID: 460430, guid: 3b671081e44be1c4aa4355e8ba6e8a5e, type: 3} m_CorrespondingSourceObject: {fileID: 460430, guid: 3b671081e44be1c4aa4355e8ba6e8a5e, type: 3}
m_PrefabInstance: {fileID: 3727631899976840241} m_PrefabInstance: {fileID: 3727631899976840241}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &8439904960820117577
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 7794002585184948680}
m_Modifications:
- target: {fileID: 122746, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_Name
value: FireballMissileGreen
objectReference: {fileID: 0}
- target: {fileID: 122746, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19904988, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19966394, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19993550, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19994796, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
--- !u!4 &8439904960819944385 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 482184, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
m_PrefabInstance: {fileID: 8439904960820117577}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8439904960820043571 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 122746, guid: 2600ac3c92a32344aac7a38b64dc2f5c, type: 3}
m_PrefabInstance: {fileID: 8439904960820117577}
m_PrefabAsset: {fileID: 0}

@ -68,10 +68,10 @@ public class PistolMember : SquadMember
private void Start() private void Start()
{ {
//particleController = GetComponent<ParticleController>(); //particleController = GetComponent<ParticleController>();
characterIndex = PlayerPrefs.GetInt("selectedCharacterIndex"); //characterIndex = PlayerPrefs.GetInt("selectedCharacterIndex");
Debug.Log("index is" + characterIndex); //Debug.Log("index is" + characterIndex);
charactersArray[characterIndex].SetActive(true); //charactersArray[characterIndex].SetActive(true);
charactersArray[characterIndex].transform.parent.GetComponent<AnimancerComponent>().Animator.avatar = characterAvatar[characterIndex]; //charactersArray[characterIndex].transform.parent.GetComponent<AnimancerComponent>().Animator.avatar = characterAvatar[characterIndex];
} }
private void HitEnemy(Transform other, Transform @object) private void HitEnemy(Transform other, Transform @object)
{ {

@ -11,4 +11,10 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Level_1.unity path: Assets/Scenes/Level_1.unity
guid: c5ddf6fc4e21e4ec18c592064edf342f guid: c5ddf6fc4e21e4ec18c592064edf342f
- enabled: 1
path: Assets/Scenes/CharactersSelection.unity
guid: 4e9c97bf49791b44484077ba575928c4
- enabled: 1
path: Assets/Scenes/Level_1 New Enemies.unity
guid: 281e83595f2fe584b9528a7e1cdb0ae5
m_configObjects: {} m_configObjects: {}

@ -15,7 +15,7 @@ TagManager:
- Default - Default
- TransparentFX - TransparentFX
- Ignore Raycast - Ignore Raycast
- - CharacterSelection
- Water - Water
- UI - UI
- Ground - Ground

Loading…
Cancel
Save