Created
January 31, 2018 21:09
-
-
Save unity3dcollege/5a5d5a74c33332dfbd5071be22224b2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class CharacterSelectionController : MonoBehaviour | |
{ | |
[SerializeField] | |
private Character[] characters; | |
public Character SelectedCharacter { get; private set; } | |
private void Start() | |
{ | |
SelectCharacter(characters[0]); | |
} | |
public void SelectCharacter(Character characterToSelect) | |
{ | |
SelectedCharacter = characterToSelect; | |
foreach(var character in characters) | |
{ | |
character.gameObject.SetActive(character == characterToSelect); | |
} | |
} | |
public void EquipCurrentCharacter(GameObject weaponPrefab) | |
{ | |
SelectedCharacter.EquipWeapon(weaponPrefab); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment