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

        _gameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 3
0
 public void RegisterListener(GameBehaviour _eventableToAdd)
 {
     if (!gameBehaviours.Contains(_eventableToAdd))
     {
         gameBehaviours.Add(_eventableToAdd);
     }
 }
Ejemplo n.º 4
0
 public static void PlayCorrectAnswerSound(GameBehaviour target)
 {
     if (CurrentUserInfo.IsSoundEnabled)
     {
         target.GetComponent <AudioSource>().Play();
     }
 }
Ejemplo n.º 5
0
 void Start()
 {
     game         = GameBehaviour.Instance;
     camera_obj   = GetComponent <Camera>();
     player_body  = player.GetComponent <Rigidbody2D>();
     player_logic = player.GetComponent <PlayerLogic>();
 }
Ejemplo n.º 6
0
    public void GoToLeaderbords(AudioSource audio)
    {
        GameBehaviour behave = GameObject.FindGameObjectWithTag("GameBehaviour").GetComponent <GameBehaviour>();


        behave.GoToLeaderbords(audio);
    }
Ejemplo n.º 7
0
    public void GoToMothership(AudioSource audio)
    {
        GameBehaviour behave = GameObject.FindGameObjectWithTag("GameBehaviour").GetComponent <GameBehaviour>();


        behave.GoToMothership(audio);
    }
Ejemplo n.º 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;
    }
Ejemplo n.º 9
0
 public static void PlayLostSound(this GameBehaviour target)
 {
     if (CurrentUserInfo.IsSoundEnabled)
     {
         target.GetComponent <AudioSource>().Play();
     }
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 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");
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 13
0
 public void UnregisterListener(GameBehaviour _eventableToRemove)
 {
     if (gameBehaviours.Contains(_eventableToRemove))
     {
         gameBehaviours.Remove(_eventableToRemove);
     }
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 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);
        }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        transform.Rotate(0, -90, 0);

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

        gameManager = GameObject.Find("GameManager").GetComponent <GameBehaviour>();
    }
Ejemplo n.º 17
0
            public IEnumerator BeforeEveryInstanceTest()
            {
                var prefab = Resources.Load <GameBehaviour>("Game");

                yield return(null);

                instance = Object.Instantiate(prefab);
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 20
0
        public void Resolve(GameWinObserver gameWinObserver, GameBehaviour game, SimulationTime time)
        {
            _time        = time;
            _game        = game;
            _winObserver = gameWinObserver;

            _winObserver.WinnerFoundEvent += OnWinnerFound;
        }
Ejemplo n.º 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>();
    }
Ejemplo n.º 22
0
        private void Awake()
        {
            this.gameBehaviour = GameBehaviour.Instance;

            if (this.gameBehaviour != null)
            {
                this.gameBehaviour.GameChanged += this.OnGameChanged;
            }
        }
Ejemplo n.º 23
0
    void Start()
    {
        game             = GameBehaviour.Instance;
        plane_body       = GetComponent <Rigidbody2D>();
        plane_collider   = GetComponent <PolygonCollider2D>();
        projectilePrefab = game.getProjectileType(projectileType);

        setMaxHealth(maxHealth);
        setHealth(getMaxHealth());
    }
Ejemplo n.º 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>();
    }
Ejemplo n.º 25
0
        private void Start()
        {
            var g = GameObject.Find("DaGame");

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

            _game.ChoppedWood.Value = true;
        }
Ejemplo n.º 26
0
 void Awake()
 {
     if (Game == null)
     {
         DontDestroyOnLoad (gameObject);
         Game = this;
     } else if (Game != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 27
0
        private void Start()
        {
            var g = GameObject.Find("DaGame");

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

            _game.OneStoneSharpened.Value = true;
        }
Ejemplo n.º 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);
        }
    }
Ejemplo n.º 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();
 }