Ejemplo n.º 1
0
    private void Start()
    {
        _glc = FindObjectOfType <GameLogicController>();
        _cs  = FindObjectOfType <CameraShake>();

        _as = _sc.controlDelusionSource;
    }
Ejemplo n.º 2
0
        private void InitGameBoard(bool initFromState = false)
        {
            gameLogicController     = new GameLogicController(selectedFigure);
            textViewFigure.Text     = $"{StringConstants.YOU_ARE_PLAYER} {selectedFigure}";
            textViewPlayerTurn.Text = $"{selectedFigure}{StringConstants.TURN}";

            //Restore game from saved state
            if (initFromState)
            {
                string gameStateJson = Settings.Get(StringConstants.GAME_STATE, string.Empty);
                gameState = JsonSerializer.Deserialize <Dictionary <int, int> >(gameStateJson);

                for (int y = 0; y < boardTiles.Length; y++)        //row
                {
                    for (int x = 0; x < boardTiles[y].Length; x++) //column
                    {
                        if (gameState.ContainsKey(boardTiles[y][x].Id))
                        {
                            textViewPlayerTurn.Text = $"{gameLogicController.GetTurn()}{StringConstants.TURN}";
                            Move playerMove = gameLogicController.MakeMove(y, x);
                            Glide.With(this).Load(playerMove.Figure == Figures.X ? StringConstants.X_URL : StringConstants.O_URL).Into(boardTiles[playerMove.Y][playerMove.X]);
                            boardTiles[y][x].Enabled = false;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
    private void Start()
    {
        // If the system does not support the accelerometer, end update routine
        if (!SystemInfo.supportsGyroscope)
        {
            gyroEnabled = false;
        }
        gyroEnabled        = true;
        Input.gyro.enabled = true;

        _glc = FindObjectOfType <GameLogicController>();
        _sc  = FindObjectOfType <SoundController>();

        IsRotatable = true;
        IsActivated = false;

        gameObject.tag = _rotTag;

        outlineEffect = GetComponent <Outline>();
        // if not existent, seach in children
        if (outlineEffect == null)
        {
            outlineEffect = this.gameObject.transform.GetComponentInChildren <Outline>();
        }
        outlineEffect.enabled = false;
    }
Ejemplo n.º 4
0
    void Start()
    {
        cgController = new GameLogicController();
        cgController.Initialize();
        cgController.OnLose(Lose);
        cgController.Player.OnHealthChanged(OnHealthChanged);
        cgController.Player.OnScoreChanged(OnScoreChanged);
        cgController.GenerateFirstSlabsStack();

        viewSlabArray  = new GameObject[cgController.MAX_SIZE, cgController.MAX_SIZE];
        viewValueSlab  = new int[cgController.MAX_SIZE, cgController.MAX_SIZE];
        viewHealthList = new List <GameObject>();

        for (int i = 0; i < cgController.MAX_SIZE; i++)
        {
            for (int j = 0; j < cgController.MAX_SIZE; j++)
            {
                viewSlabArray[i, j] = InitializeSlab(i, j);

                cgController.Slabs[i, j].OnKill(OnKill);
                cgController.Slabs[i, j].OnIndexChanged(OnIndexChanged);
                cgController.Slabs[i, j].OnTeleported(OnSlabTeleported);
            }
        }

        for (int i = 0; i < cgController.Player.HealthPoint; i++)
        {
            viewHealthList.Add(Instantiate(healthPrefab));
            viewHealthList[i].transform.SetParent(parentHealth);
            viewHealthList[i].transform.localScale = Vector3.one;
        }
    }
Ejemplo n.º 5
0
        public void RemoveUser(ClaimsPrincipal user, Action <long> onGameFinish, Action <long> onTurnTimeout)
        {
            lock (lobbyLock)
            {
                if (!HasUser(user))
                {
                    return;
                }

                var removeUser = players
                                 .Where((item) => item.GetUserLoginID() == user.GetUserLoginID())
                                 .FirstOrDefault();

                players.Remove(removeUser);
                hosts.Remove(removeUser);
                if (hosts.Count == 0 && players.Count > 0)
                {
                    hosts.Add(players[0]);
                }
                if (InGame())
                {
                    GameLogicController.GameUserLeave(removeUser, onTurnTimeout, onGameFinish);
                }
            }
        }
Ejemplo n.º 6
0
    private void Awake()
    {
        _glc = FindObjectOfType <GameLogicController>();
        _sc  = FindObjectOfType <SceneController>();
        _pmc = playerCharacter.GetComponent <PlayerMovementController>();

        _glc.PlayerDiedEvent += OnPlayerDeath;
    }
Ejemplo n.º 7
0
    private void Start()
    {
        // _renderer = playerCharacter.GetComponent<Renderer>();
        //if (_renderer != null)
        //    _baseMaterial = _renderer.material;

        _glc = FindObjectOfType <GameLogicController>();

        _as = _sc.nihilismDelusionSource;
    }
Ejemplo n.º 8
0
    private void Start()
    {
        _glc = FindObjectOfType <GameLogicController>();
        _sc  = FindObjectOfType <SoundController>();

        _glc.DelusionActivityEvent += OnDilusionActive;

        PopulateDelusionTimings(0);
        ScheduleDelusionStarts();
    }
Ejemplo n.º 9
0
        public bool StartGame(Action <long> onPreparationEnd)
        {
            lock (lobbyLock)
            {
                if (players.Count < 3)
                {
                    return(false);
                }

                var callPhaseDuration        = GetCallPhaseDuration(GameMode);
                var turnPhaseDuration        = GetTurnPhaseDuration(GameMode);
                var preparationPhaseDuration = 10000;

                List <int> gameScores;
                if (players.Count == 2)
                {
                    gameScores = new List <int>()
                    {
                        1, -1
                    };
                }
                else if (players.Count == 3)
                {
                    gameScores = new List <int>()
                    {
                        1, 0, -1
                    };
                }
                else if (players.Count == 4)
                {
                    gameScores = new List <int>()
                    {
                        2, 1, 0, -1
                    };
                }
                else
                {
                    gameScores = new List <int>()
                    {
                    };
                }

                GameLogicController = new GameLogicController();
                GameLogicController.StartGame(
                    players,
                    GameLobbyID,
                    callPhaseDuration,
                    turnPhaseDuration,
                    preparationPhaseDuration,
                    onPreparationEnd,
                    gameScores);
                return(true);
            }
        }
Ejemplo n.º 10
0
    public Game(GameLogicController gameContoller, int pinCount, int startingPinNumber, int ringCount) //constructor
    {
        this.gameContoller = gameContoller;
        logic = new Logic();

        var startingPinSafe = Mathf.Clamp(startingPinNumber, 1, pinCount);//clamping startingpinnumber to prevent wrong entries

        for (int i = 0; i < pinCount; i++)
        {
            pins.Add(new Pin(ringCount, i == startingPinSafe - 1));
        }
    }
Ejemplo n.º 11
0
 private void Awake()
 {
     // Create a GameLogicController singleton instance if there is none
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         // Destroy if there is already a GameLogicController singleton instance
         Destroy(this);
     }
 }
Ejemplo n.º 12
0
    private void Start()
    {
        //destinationPosition = transform.position;
        _glc      = FindObjectOfType <GameLogicController>();
        _meshRend = GetComponentsInChildren <MeshRenderer>();
        foreach (MeshRenderer rend in _meshRend)
        {
            rend.enabled = false;
        }

        baseSpeed = agent.speed;

        // Save waiting position for persecutor to go back to it after hunt
        waitingPosition = transform.position;
    }
Ejemplo n.º 13
0
    void Start()
    {
        //tidies up the editor, personal preference
        garboCollect = FindObjectOfType <GarbageCollector>();

        //initialize gameLogicController
        gameLogicController = FindObjectOfType <GameLogicController>();

        //initialize transforms/rotations at the beginning
        //of the game, to allow ADS functionality
        GunADSInitializer();

        //initializing our FPSController so that we can change sensitivity/etc.
        standardFPSController = GetComponentInParent <RigidbodyFirstPersonController>();

        gunAudioController = GetComponent <AudioSource>();
    }
Ejemplo n.º 14
0
    void Start()
    {
        Camera camcam = Camera.main;
        float screenHeight = camcam.GetScreenHeight()-1;
        camcam.orthographicSize = screenHeight / 2.0f;

        if(instance == null)
        {
            instance = this;

            DontDestroyOnLoad (gameObject);

            Instantiate(gestureInitializer);
            Instantiate(gestureManager);
            Instantiate(networkManager);

            levelProgression = new string[] {"NotAlone", "Level2", "Level3"};
        }
        else
            DestroyImmediate(gameObject);
    }
Ejemplo n.º 15
0
    private void Start()
    {
        _charController = GetComponent <CharacterController>();
        _glc            = FindObjectOfType <GameLogicController>();

        _animator = GetComponent <Animator>();
        _animatorSpeedHashParam = Animator.StringToHash("Speed");

        _currentJumpHeight = 0;

        _baseSpeed     = speed;
        _baseJumpSpeed = jumpSpeed;

        // Add event listeners
        InputsDisabled            = InputsDelayed = InvertedControls = false;
        _glc.InputsInvertedEvent += OnInputsInverted;
        _glc.InputsDisabledEvent += OnInputsDisabled;
        _glc.InputsDelayedEvent  += OnInputsDelayed;

        Alive = true;
    }
Ejemplo n.º 16
0
    void Start()
    {
        Camera camcam       = Camera.main;
        float  screenHeight = camcam.GetScreenHeight() - 1;

        camcam.orthographicSize = screenHeight / 2.0f;

        if (instance == null)
        {
            instance = this;

            DontDestroyOnLoad(gameObject);

            Instantiate(gestureInitializer);
            Instantiate(gestureManager);
            Instantiate(networkManager);

            levelProgression = new string[] { "NotAlone", "Level2", "Level3" };
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
Ejemplo n.º 17
0
 private void Awake()
 {
     gameLogicController = FindObjectOfType <GameLogicController>();
 }
Ejemplo n.º 18
0
 private void Start()
 {
     _glc = FindObjectOfType <GameLogicController>();
     _glc.DelusionActivityEvent += OnDilusionActive;
 }
Ejemplo n.º 19
0
 private void Start()
 {
     _glc = FindObjectOfType <GameLogicController>();
     _glc.CameraIsMovingEvent += OnCameraIsMoving;
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     _glc = FindObjectOfType <GameLogicController>();
     _glc.InputsInvertedEvent += (bool inverted) => Debug.Log(inverted);
 }
Ejemplo n.º 21
0
 void Start()
 {
     //allows game logic such as player death and other logic in the future
     gameLogicController = FindObjectOfType <GameLogicController>();
 }
Ejemplo n.º 22
0
 private void Awake()
 {
     _glc = FindObjectOfType <GameLogicController>();
     _sc  = FindObjectOfType <SceneController>();
     _glc.PlayerDiedEvent += OnPlayerDied;
 }