input type switcher

This commit is contained in:
2023-05-30 20:14:07 +02:00
parent 8d70560861
commit 58fe57722d
5 changed files with 759 additions and 15 deletions

View File

@@ -42,7 +42,8 @@ public class GroundController : MonoBehaviour
Debug.Log("ground length: " + ground.Length);
}
newMaterial = materials[0];
newMaterial = materials[0]; //correct color
Debug.Log(newMaterial.color);
}
private void Move(GameObject move)

View File

@@ -19,6 +19,9 @@ public class PlayerController : MonoBehaviour
private Vector2 startTouchPosition; //erintes kezdo pozicio
private Vector2 endTouchPosition; //erintes vegpozicio
[SerializeField] private Button buttonControl;
[SerializeField] private Button swipeControl;
public ControlType activeControllType; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas
public Button leftButton;
@@ -35,13 +38,30 @@ public class PlayerController : MonoBehaviour
cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia
isGrounded = FindObjectOfType<IsGrounded>();
//activeControllType = ControlType.Button;
if(activeControllType == ControlType.Swipe){
SwipeControl();
}
if(activeControllType == ControlType.Button){
ButtonControl();
}
}
public void setControllType(ControlType controlltype){
private void setControllType(ControlType controlltype){
activeControllType = controlltype;
}
public void ButtonControl(){
setControllType(ControlType.Button);
swipeControl.image.color = Color.white;
buttonControl.image.color = Color.red;
}
public void SwipeControl(){
setControllType(ControlType.Swipe);
swipeControl.image.color = Color.red;
buttonControl.image.color = Color.white;
}
private void Update(){
if(activeControllType == ControlType.Swipe){

View File

@@ -43,6 +43,8 @@ public class jatekmanager : MonoBehaviour
private Timer timer;
private CoinCounter cc;
[SerializeField] private GameObject controlTypeSwitcher;
[SerializeField] private CinemachineVirtualCamera homeCamera;
@@ -59,7 +61,6 @@ public class jatekmanager : MonoBehaviour
score = FindObjectOfType<Score>();
timer = FindObjectOfType<Timer>();
cc = FindObjectOfType<CoinCounter>();
}
private void Start()
@@ -129,6 +130,8 @@ public class jatekmanager : MonoBehaviour
goRightButton.SetActive(false);
scoreText.gameObject.SetActive(false);
timerText.gameObject.SetActive(false);
controlTypeSwitcher.SetActive(false);
}
private async void HandleHome()
@@ -147,6 +150,7 @@ public class jatekmanager : MonoBehaviour
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
controlTypeSwitcher.SetActive(false);
}
IEnumerator TimerHome()
@@ -163,6 +167,7 @@ public class jatekmanager : MonoBehaviour
volumeSlide.SetActive(true);
musicSlide.SetActive(true);
sfxSlide.SetActive(true);
controlTypeSwitcher.SetActive(true);
}
private async void HandleSettings()
@@ -177,12 +182,12 @@ public class jatekmanager : MonoBehaviour
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
controlTypeSwitcher.SetActive(false);
}
public void ChangeToShop()
{
UpdateGameState(GameState.Shop);
UpdateGameState(GameState.Shop);
}
private async void HandleShop()
@@ -196,6 +201,7 @@ public class jatekmanager : MonoBehaviour
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
controlTypeSwitcher.SetActive(false);
}
public void ChangeToGame()
@@ -210,6 +216,7 @@ public class jatekmanager : MonoBehaviour
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
controlTypeSwitcher.SetActive(false);
}
IEnumerator TimerGame()
@@ -234,7 +241,7 @@ public class jatekmanager : MonoBehaviour
jumpButton.SetActive(true);
goRightButton.SetActive(true);
scoreText.gameObject.SetActive(true);
timerText.gameObject.SetActive(true);;
timerText.gameObject.SetActive(true);
timer.playTime.Start();
}

View File

@@ -20,7 +20,7 @@ public class portal : MonoBehaviour
{
if(other.gameObject.tag.Equals("Player")){
gc.ChangeMaterial(gc.materials[random]);
gc.ModuleColorChange();
//gc.ModuleColorChange();
}
}