Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class LeverItem : MonoBehaviour
- {
- public GameObject Charcter_1;
- public GameObject Horse_1;
- public GameObject Cab_1;
- public GameObject Wagon_1;
- private State currentState; //текущее состояние (стреляет, перезаряжается или ничего не делает?)
- private void Start()
- {
- SetState(State.Charcter);
- }
- private void SetState(State state)
- {
- currentState = state;
- Charcter_1.SetActive(state == State.Charcter);
- Horse_1.SetActive(state == State.Horse);
- Cab_1.SetActive(state == State.Cab);
- Wagon_1.SetActive(state == State.Wagon);
- }
- private enum State
- {
- Charcter,
- Horse,
- Cab,
- Wagon
- }
- void CharcterOn ()
- {
- SetState(State.Charcter);
- }
- void HorseOn()
- {
- SetState(State.Horse);
- }
- void CabOn()
- {
- SetState(State.Cab);
- }
- void WagonOn()
- {
- SetState(State.Wagon);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement