-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectScript2.cs
102 lines (91 loc) · 2.76 KB
/
SelectScript2.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SelectScript2 : MonoBehaviour
{
public GameObject Broly2;
public GameObject Goku2;
private Vector3 CharPos2;
private Vector3 offScreen2;
private int CharInt2 = 1;
private SpriteRenderer Goku2Render, Broly2Render;
private readonly string selectChar2 = "selectedCharacter2";
private void Awake()
{
CharPos2 = Broly2.transform.position;
offScreen2 = Goku2.transform.position;
Goku2Render = Goku2.GetComponent<SpriteRenderer>();
Broly2Render = Broly2.GetComponent<SpriteRenderer>();
}
public void NextChar2()
{
switch (CharInt2)
{
case 1:
PlayerPrefs.SetInt(selectChar2, 1);
Goku2Render.enabled = false;
Goku2.transform.position = offScreen2;
Broly2.transform.position = CharPos2;
Broly2Render.enabled = true;
CharInt2++;
break;
case 2:
PlayerPrefs.SetInt(selectChar2, 2);
Broly2Render.enabled = false;
Broly2.transform.position = offScreen2;
Goku2.transform.position = CharPos2;
Goku2Render.enabled = true;
CharInt2++;
ResetInt2();
break;
default:
ResetInt2();
break;
}
}
public void PrevChar2()
{
switch (CharInt2)
{
case 1:
PlayerPrefs.SetInt(selectChar2, 1);
Goku2Render.enabled = false;
Goku2.transform.position = offScreen2;
Broly2.transform.position = CharPos2;
Broly2Render.enabled = true;
ResetInt2();
break;
case 2:
PlayerPrefs.SetInt(selectChar2, 2);
Broly2Render.enabled = false;
Broly2.transform.position = offScreen2;
Goku2.transform.position = CharPos2;
Goku2Render.enabled = true;
CharInt2--;
break;
default:
ResetInt2();
break;
}
}
private void ResetInt2()
{
if (CharInt2 >= 2)
{
CharInt2 = 1;
}
else
{
CharInt2 = 2;
}
}
public void ConfirmButton()
{
SceneManager.LoadScene("maps");
}
public void Player2()
{
SceneManager.LoadScene("Player2Select");
}
}