-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetMainChar.cs
41 lines (35 loc) · 1001 Bytes
/
GetMainChar.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetMainChar : MonoBehaviour
{
public Sprite GokuSprite, BrolySprite;
public GameObject Goku;
public GameObject Broly;
private SpriteRenderer mySprite;
private readonly string selectChar = "selectedCharacter";
void Awake()
{
mySprite = this.GetComponent<SpriteRenderer>();
}
void Start()
{
int getChar;
getChar = PlayerPrefs.GetInt(selectChar);
switch (getChar)
{
case 1:
mySprite.sprite = BrolySprite;
Goku.SetActive(false);
break;
case 2:
mySprite.sprite = GokuSprite;
Broly.SetActive(false);
break;
default:
mySprite.sprite = BrolySprite;
Goku.SetActive(false);
break;
}
}
}