private void Start()
    {
        _rb  = GetComponent <Rigidbody>();
        _col = GetComponent <CapsuleCollider>();

        _gameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();
    }
Пример #2
0
    //Setting


    void Start()
    {
        if (GameBehaviour.gb == null)
        {
            GameBehaviour.gb = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
        DontDestroyOnLoad(this);

        Starter.s.button.SetActive(true);
        players = new List <Player> ();

        Table = new List <Card>();
        Deck  = new List <Card>(CardValue.Count * CardType.Count);

        for (int i = 0; i < CardValue.Count; i++)
        {
            for (int j = 0; j < CardType.Count; j++)
            {
                Deck.Add(new Card(CardValue [i], CardType[j]));
            }
        }

//        Instantiate(StartGame);
    }
Пример #3
0
 public void RegisterListener(GameBehaviour _eventableToAdd)
 {
     if (!gameBehaviours.Contains(_eventableToAdd))
     {
         gameBehaviours.Add(_eventableToAdd);
     }
 }
Пример #4
0
 public static void PlayCorrectAnswerSound(GameBehaviour target)
 {
     if (CurrentUserInfo.IsSoundEnabled)
     {
         target.GetComponent <AudioSource>().Play();
     }
 }
Пример #5
0
 void Start()
 {
     game         = GameBehaviour.Instance;
     camera_obj   = GetComponent <Camera>();
     player_body  = player.GetComponent <Rigidbody2D>();
     player_logic = player.GetComponent <PlayerLogic>();
 }
Пример #6
0
    public void GoToLeaderbords(AudioSource audio)
    {
        GameBehaviour behave = GameObject.FindGameObjectWithTag("GameBehaviour").GetComponent <GameBehaviour>();


        behave.GoToLeaderbords(audio);
    }
Пример #7
0
    public void GoToMothership(AudioSource audio)
    {
        GameBehaviour behave = GameObject.FindGameObjectWithTag("GameBehaviour").GetComponent <GameBehaviour>();


        behave.GoToMothership(audio);
    }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        GameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();

        vInput = Input.GetAxis("Vertical") * VitesseMouvement;
        hInput = Input.GetAxis("Horizontal") * VitesseRotation;
    }
Пример #9
0
 public static void PlayLostSound(this GameBehaviour target)
 {
     if (CurrentUserInfo.IsSoundEnabled)
     {
         target.GetComponent <AudioSource>().Play();
     }
 }
Пример #10
0
    private void onNewState(int state)
    {
        //Debug.Log("on new state");
        if (state == hitState)
        {
            this.sumDeltaTime = 0.0f;
        }
        else if (state == waitingState)
        {
            GameBehaviour behaviour = GameObject.FindObjectOfType <GameBehaviour>();
            behaviour.reserveTentacle(gameObject);

            if (this.sumDeltaTime > 0.0)
            {
                timestamps.Add(this.sumDeltaTime);
            }
            this.sumDeltaTime = 0.0f;
        }
        else if (state == idleState)
        {
            this.sumDeltaTime = 0.0f;
        }

        ObjectState = state;
    }
Пример #11
0
    private void checkFuelOnOutOfBounds()
    {
        if (fuel <= 0.0f)
        {
            GameBehaviour.changeGameState(GameBehaviour.GameState.Finish);
        }
        else
        {
            float actual_fuel_lost;

            if (fuel < FUEL_LOST_ON_EXPLOSION)
            {
                actual_fuel_lost = fuel;
            }
            else
            {
                actual_fuel_lost = FUEL_LOST_ON_EXPLOSION;
            }

            fuel -= actual_fuel_lost;

            display_behaviour.updateStandbyMessage("Your lander disappeared\n" + ((int)actual_fuel_lost).ToString() + " units of fuel lost");
            GameBehaviour.changeGameState(GameBehaviour.GameState.Standby);
        }

        lander_animator.SetTrigger("LanderExplosion");
    }
Пример #12
0
    private void checkFuelOnCrash()
    {
        if (fuel <= 0.0f)
        {
            GameBehaviour.changeGameState(GameBehaviour.GameState.Finish);
        }
        else
        {
            float actual_fuel_lost;

            if (fuel < FUEL_LOST_ON_EXPLOSION)
            {
                actual_fuel_lost = fuel;
            }
            else
            {
                actual_fuel_lost = FUEL_LOST_ON_EXPLOSION;
            }

            fuel -= actual_fuel_lost;

            display_behaviour.updateStandbyMessage("Your lander exploded\n" + ((int)actual_fuel_lost).ToString() + " units of fuel lost");
            GameBehaviour.changeGameState(GameBehaviour.GameState.Standby);
        }

        lander_animator.SetTrigger("LanderExplosion");
        AudioSource.PlayClipAtPoint(explosion_audio_clip, transform.position, AUDIO_CLIPS_VOLUME);
    }
Пример #13
0
 public void UnregisterListener(GameBehaviour _eventableToRemove)
 {
     if (gameBehaviours.Contains(_eventableToRemove))
     {
         gameBehaviours.Remove(_eventableToRemove);
     }
 }
Пример #14
0
    void Start()
    {
        _gameArchive = File.ReadAllLines(SavePath + "ArchiveData.txt").ToList();

        _games = new List <GameBehaviour>();

        var gameManagers = GameManager.LoadGamesFromFile(SavePath + "CurrentGame.txt");

        _playerUiSettings = PlayerUiSettings.Load();
        _games.Add(GameBehaviour.CreateGameBehaviour(gameObject, GuiSkin, BoardTile, Piece, Text, ((short)0).ToCartesianCoordinate(), gameManagers.First(), _gameArchive, _playerUiSettings));

        _activeGame = _games.First();

        _searchMethods = new[] { new GUIContent("NegaMax"), new GUIContent("NegaMax w/ Alpha-Beta") };
        _searchDepths  = new[]
        {
            new GUIContent("Search Depth 0"),
            new GUIContent("Search Depth 1"),
            new GUIContent("Search Depth 2"),
            new GUIContent("Search Depth 3"),
            new GUIContent("Search Depth 4"),
            new GUIContent("Search Depth 5"),
            new GUIContent("Search Depth 6"),
            new GUIContent("Search Depth 7"),
        };
        _searchComboBox.SelectedItemIndex = _playerUiSettings.SearchMethod;
        _depthComboBox.SelectedItemIndex  = _playerUiSettings.SearchDepth;

        listStyle.normal.textColor   = Color.white;
        listStyle.onHover.background = listStyle.hover.background = new Texture2D(2, 2);
        listStyle.padding.left       = listStyle.padding.right = listStyle.padding.top = listStyle.padding.bottom = 4;
    }
Пример #15
0
        private void Start()
        {
            var g = GameObject.Find("DaGame");

            if (g)
            {
                _game = g.gameObject.GetComponent <GameBehaviour>();
            }

            GetComponent <Fuel>().OnFuelAmountChanges()
            .Skip(1)
            .Take(1)
            .Subscribe(f =>
            {
                _game.WoodBurning.Value++;
                _isBurning = true;
            })
            .AddTo(gameObject);

            this.OnDestroyAsObservable()
            .Subscribe(unit =>
            {
                if (_isBurning)
                {
                    _game.WoodBurning.Value--;
                }
            })
            .AddTo(gameObject);
        }
Пример #16
0
    // Use this for initialization
    void Start()
    {
        transform.Rotate(0, -90, 0);

        anim = this.gameObject.GetComponent <Animator>();

        gameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();
    }
Пример #17
0
            public IEnumerator BeforeEveryInstanceTest()
            {
                var prefab = Resources.Load <GameBehaviour>("Game");

                yield return(null);

                instance = Object.Instantiate(prefab);
            }
Пример #18
0
 void Start()
 {
     rb     = this.GetComponent <Rigidbody2D>();
     gb     = GameObject.FindObjectOfType <GameBehaviour>();
     anim   = this.transform.GetComponent <Animator>();
     sr     = this.transform.GetComponent <SpriteRenderer>();
     myTurn = 0;
 }
        public void TransformTest()
        {
            GameObject    go = new GameObject("TransformTest");
            GameBehaviour t  = go.AddComponent <GameBehaviour>();

            Assert.IsNotNull(t.GetTransform());
            ObjectUtility.Destroy(go);
        }
Пример #20
0
        public void Resolve(GameWinObserver gameWinObserver, GameBehaviour game, SimulationTime time)
        {
            _time        = time;
            _game        = game;
            _winObserver = gameWinObserver;

            _winObserver.WinnerFoundEvent += OnWinnerFound;
        }
Пример #21
0
    private void Start()
    {
        //set the players Rigidbody to the _rb variable
        _rb  = GetComponent <Rigidbody>();
        _col = GetComponent <CapsuleCollider>();

        _gameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();
    }
Пример #22
0
        private void Awake()
        {
            this.gameBehaviour = GameBehaviour.Instance;

            if (this.gameBehaviour != null)
            {
                this.gameBehaviour.GameChanged += this.OnGameChanged;
            }
        }
Пример #23
0
    void Start()
    {
        game             = GameBehaviour.Instance;
        plane_body       = GetComponent <Rigidbody2D>();
        plane_collider   = GetComponent <PolygonCollider2D>();
        projectilePrefab = game.getProjectileType(projectileType);

        setMaxHealth(maxHealth);
        setHealth(getMaxHealth());
    }
Пример #24
0
    // Use this for initialization
    void Start()
    {
        networkManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <CommunicationBehaviour>();
        sparkGenerator = GameObject.Find("SparkGenerator");
        currHP         = totalHP;

        manabar       = GameObject.Find("PortalManaBar").GetComponent <Slider>();
        manabar.value = 0;

        behaviour = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameBehaviour>();
    }
Пример #25
0
        private void Start()
        {
            var g = GameObject.Find("DaGame");

            if (g)
            {
                _game = g.gameObject.GetComponent <GameBehaviour>();
            }

            _game.ChoppedWood.Value = true;
        }
Пример #26
0
 void Awake()
 {
     if (Game == null)
     {
         DontDestroyOnLoad (gameObject);
         Game = this;
     } else if (Game != this)
     {
         Destroy(gameObject);
     }
 }
Пример #27
0
        private void Start()
        {
            var g = GameObject.Find("DaGame");

            if (g)
            {
                _game = g.gameObject.GetComponent <GameBehaviour>();
            }

            _game.OneStoneSharpened.Value = true;
        }
Пример #28
0
    // Use this for initialization
    protected override void FetchReferences()
    {
        base.FetchReferences();
        game = GameBehaviour.Instance;
        ui.SetPlayer(this);
        xVec = 0;
        yVec = 0;

        xIn = xDir.none;
        yIn = yDir.none;
    }
    void Start()
    {
        game = GameBehaviour.Instance;

        if (transform.position.y < (game.getWaterLevel() + 10))
        {
            var exp_pos = transform.position;
            exp_pos.z = 0;
            exp_pos.y = game.getWaterLevel();

            Instantiate(waterExplosion_fx, exp_pos, Quaternion.identity);
        }
    }
Пример #30
0
    public static void RemoveFromGame(GameObject victim)
    {
        GameBehaviour handler = victim.GetComponent <GameBehaviour>();

        if (handler)
        {
            handler.RemoveFromGame();
        }
        else
        {
            RequestDefaultDestruction(victim);
        }
    }
 IEnumerator ShowAll()
 {
     while (queue.Count > 0)
     {
         ShowNext();
         while (clicked == null)
         {
             yield return(null);
         }
     }
     gameObject.SetActive(false);
     GameBehaviour.ContinueGame();
 }