示例#1
0
 void Awake()
 {
     _instance        = this;
     _stateController = new StateBase();
     _stateController.Start();
     _curState     = _stateController.State;
     _audio        = GameObject.Find("Audio").GetComponent <AudioSource>();
     players       = new List <Player>();
     _winnerPlayer = null;
 }
    private void RpcSyncState(StateBase.ESubState newState)
    {
        if (_curState != newState)
        {
            _curState = newState;
        }

        if (_stateController.State != newState)
        {
            _stateController.State = newState;
        }
    }
    public void OnStateChanged(StateBase.ESubState newState)
    {
        if (_curState != newState)
        {
            _curState = newState;
        }

        if (isServer)
        {
            RpcSyncState(newState);
        }
    }
    private void Awake()
    {
        // First we check if there are any other instances conflicting

        /*if (Instance != null && Instance != this)
         * {
         *  // If that is the case, we destroy other instances
         *  Destroy(gameObject);
         * }*/
        Instance = this;
        DontDestroyOnLoad(gameObject);

        _stateController = new StateBase();
        _stateController.Start();
        _curState = _stateController.State;
        _audio    = GetComponent <AudioSource>();
        //players = new List<Player>();
        _winnerPlayer = null;

        StartNormalGame();
    }
示例#5
0
 private void OnCurrentStateChanged(StateBase.ESubState newState)
 {
     _stateController.State = newState;
 }
示例#6
0
 public void OnStateChanged(StateBase.ESubState newState)
 {
     _curState = newState;
 }