Inheritance: MonoBehaviour
	void Start () {
        root = GameObject.Find("UI Root");
        gm = GameObject.Find("GameManager").GetComponent<GameManager>();
        nameLabel = root.transform.Find("Avg_Panel/Label_Name").GetComponent<UILabel>();
        dialogLabel = root.transform.Find("Avg_Panel/Label_Dialog").GetComponent<UILabel>();
        nameLabel.fontSize = 22;
	}
 void Start()
 {
     GMScript = GM.GetComponent<GameManager>();
     rb = GetComponent<Rigidbody>();
     GMScript.setScore();
     GMScript.setLives ();
 }
Exemple #3
0
 public InputManager(GameManager gameManager)
 {
     _lastKeyboardState = Keyboard.GetState();
     _gameManager = gameManager;
     HasTouchCapabilities = TouchPanel.GetCapabilities().IsConnected;
     TouchPanel.EnabledGestures = GestureType.Tap;
 }
Exemple #4
0
 void Awake()
 {
     var manager = GameObject.Find("_Managers");
     GameManager = manager.GetComponent<GameManager>();
     SceneManager = manager.GetComponent<SceneManager>();
     MusicManager = manager.GetComponent<MusicManager>();
 }
 void Start()
 {
     tParent = transform.parent;
     networkView = tParent.GetComponent <NetworkView>();
     gameObject.SetActive(networkView.isMine);
     gm = GameManager.Instance;
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     PlayerCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); // Find the Camera's GameObject from its tag
     _GameManager = gameObject.GetComponent<GameManager>();
     _player1AI = _GameManager.player1AI;
     _player2AI = _GameManager.player2AI;
 }
Exemple #7
0
    public void DropAll()
    {
        for (int i = 0; i < tileRow.Length; i++)
        {
            tileRow[i].DropTiles();
        }

        foreach(Obstacle obs in obstacles) {
            if(obs != null) {
                obs.Drop();
                obs.GetComponent<SpriteRenderer>().sortingOrder = -10;

                SpriteRenderer[] spriteRenderers = obs.GetComponentsInChildren<SpriteRenderer>();

                for (int i = 0; i < spriteRenderers.Length; i++)
                {
                    spriteRenderers[i].sortingOrder = -10;
                }
            }
        }

        foreach(Collectible coll in collectibles) {
            if(coll != null) {
                coll.Drop();
                coll.GetComponent<SpriteRenderer>().sortingOrder = -10;
            }
        }

        Gem gem = gameObject.GetComponentInChildren<Gem>();
        if(gem != null) {
            gem.Drop();
            gm = GameObject.FindObjectOfType<GameManager>();
            gm.GemDropped();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (gManager == null) {
            gManager=GameManager.Instance();
        }
        //Debug.Log (interactions.getIsGrabbed());
        if (gManager.currentLevel != GameManager.LevelStatus.planting) {
            gameObject.SetActive(false);
        }

        Debug.Log (this.name + " " + interactions.getIsGrabbed ());
        if (interactions.getIsGrabbed()&&!downTime&&!gManager.isHandGrabbing())
        {
            //Debug.Log("I have seeds");
            GameObject newObject;
            newObject= (GameObject)(Instantiate(thisIsABagOf,interactions.getCursorPosition(), Quaternion.identity));

            newObject.SendMessage("SetGrabbed", SendMessageOptions.DontRequireReceiver);
            downTime= true;
            someTime= Time.time;
        }
        if (!interactions.getIsGrabbed()&&downTime&&(Time.time-someTime)>1)

        {
            downTime= false;
        }
    }
 // Use this for initialization
 void Start()
 {
     transform.eulerAngles = Vector3.up * 90;
     playerPhysics = GetComponent<PlayerPhysics> ();
     animator = GetComponent<Animator> ();
     manager = Camera.main.GetComponent<GameManager>();
 }
Exemple #10
0
 public void Initialize(float speed, GameObject player, GameManager manager)
 {
     SetSpeed (speed);
     this.player = player;
     this.manager = manager;
     scored = false;
 }
 public MultiplayerRaceMode(GameManager gameInstance, int laps, int noOfCheckpoints, RaceTrack raceTrack, Car localCar)
     : base(gameInstance, laps, noOfCheckpoints, raceTrack, localCar)
 {
     this.Mode = Mode.Multiplayer;
     players.AddRange(gameInstance.GetService<ServerClient>().Players.Values);
     AddLapTriggers();
 }
 // Use this for initialization
 void Start()
 {
     if (GameObject.Find("GameManager"))
     {
         gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
     }
 }
Exemple #13
0
    void Start()
    {
        if (DayTracker.currentDay == 0)
        {
            MainMenuScreen.SetActive(true);
            GameScreen.SetActive(false);
        }
        else if (DayTracker.currentDay < 5)
        {
            MainMenuScreen.SetActive(false);
            GameScreen.SetActive(true);
            gameStart = true;
        }
        else
        {
            Restart();
        }

        for (int i = 0; i < DayTracker.currentDay + 1; i++)
        {
            AddTask(TaskList[i]);
        }
        MusicManager.StartPlaying();

        m_instance = this;
        m_currentTask = 0;
    }
 void OnEnable()
 {
     if (gm == null)
     {
         gm = GameObject.FindGameObjectWithTag("GM").GetComponent<GameManager>();
     }
 }
Exemple #15
0
	// Use this for initialization
	public void Initialize (GameManager.team team)
	{
		//Loop through the object prefabs and make a new list for each one.
		//We do this because the pool can only support prefabs set to it in the editor,
		//so we can assume the lists of pooled objects are in the same order as object prefabs in the array
		pooledObjects = new List<GameObject>[objectPrefabs.Length];

		int i = 0;
		foreach ( GameObject objectPrefab in objectPrefabs )
		{
			pooledObjects[i] = new List<GameObject>(); 
			
			int bufferAmount;
			
			if(i < amountToBuffer.Length) bufferAmount = amountToBuffer[i];
			else
				bufferAmount = defaultBufferAmount;

			for ( int n=0; n<bufferAmount; n++)
			{
				GameObject newObj = null;

				newObj = Instantiate(objectPrefab) as GameObject;
				newObj.name = objectPrefab.name;
				PoolObject(newObj);
			}
			
			i++;
		}
	}
Exemple #16
0
 // Use this for initialization
 void Start()
 {
     SilhouetteBG = gameObject.transform.GetChild(0).GetComponent<RectTransform>();
     Boat = GameObject.Find("Boat");
     mGame = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>();
     //SilhouetteCanvas = SilhouetteCanvasObj.GetComponent<
 }
Exemple #17
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
            if (instance == null)

                //if not, set instance to this
                instance = this;

            //If instance already exists and it's not this:
            else if (instance != this)

                //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
                Destroy(gameObject);

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(gameObject);

            //Assign enemies to a new List of Enemy objects.
            //enemies = new List<Enemy>();
            //transform.name.Replace("(clone)", "").Trim();

            //Get a component reference to the attached BoardManager script
            boardScript = GetComponent<BoardManager>();

            //Call the InitGame function to initialize the first level
            InitGame();

            ////////////my test for block
            //CreateLevelFromJavatoXml block = new CreateLevelFromJavatoXml();
    }
    public GameObject CreateGameCharacterCard(GameManager.GameSide side, Card cardData)
    {
        if (Global.Instance.scene == SceneType.GameScene)
        {
            //实例化卡牌
            GameObject prefeb = Resources.Load<GameObject>("CharacterCard");
            GameObject parent = GameObject.Find("GamePanel/" + side.ToString() + "side/CardGrid");
            GameObject card = NGUITools.AddChild(parent, prefeb);

            CardContainer container = card.GetComponent<CardContainer>();
            container.SetCardData(cardData);//设置卡片属性
            container.UpdateCardUI();//更新贴图
            uiManager.AddCharacterUIListener(card, side);//添加UI事件监听
            container.SetGameSide(side);//设置卡片归属方

            parent.GetComponent<UIGrid>().Reposition();//更新卡片位置

            return card;
        }
        else
        {
            LogsSystem.Instance.Print("不能在非游戏界面生成游戏卡牌", LogLevel.WARN);
            return null;
        }
    }
 // Use this for initialization
 void Start()
 {
     //Set empty color inputs; get references to PM and GM
     activeColors = new List<InputColor>();
     PM = (PhotonManager) GameObject.FindGameObjectWithTag("PhotonManager").GetComponent<PhotonManager>();
     GM = (GameManager) GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
 }
Exemple #20
0
 void Start()
 {
     manager = GameManager.find();
     text = GetComponent<TextMesh>();
     antiAliasLevel = manager.antiAliasLevel;
     updateText();
 }
Exemple #21
0
    protected void Awake()
    {
        if(sInstance != null)
        {
            Destroy(gameObject);
            return;
        }

        sInstance = this;

        if (mDungeon == null)
        {
            mDungeon = FindObjectOfType<Dungeon>();
        }

        if (mFollowCamera == null)
        {
            mFollowCamera = FindObjectOfType<FollowCamera>();
        }

        if(mFader == null)
        {
            mFader = FindObjectOfType<Fader>();
        }

        GameObject goalObj = SpawnPrefab(mGoalPrefab);
        mGoal = goalObj.GetComponent<Goal>();
        GameObject playerObj = SpawnPrefab(GlobalData.sSelectedCharacter == SelectedCharacter.Rose ? mPlayerRosePrefab : mPlayerVuPrefab);
        mPlayer1 = playerObj.GetComponent<PlayerController>();
        mFollowCamera.Init(mPlayer1.transform);
    }
 /// <summary>
 /// Inicia o jogador
 /// </summary>
 void Start()
 {
    playerPhysics = GetComponent<PlayerPhysics>();
    animator = GetComponent<Animator>();
    manager = Camera.main.GetComponent<GameManager>();
    animator.SetLayerWeight(0, 0);
 }
Exemple #23
0
	// ================================================================================================================
	// EXTENDED INTERFACE ---------------------------------------------------------------------------------------------

	void Awake() {
		DontDestroyOnLoad(gameObject);

		instance = this;
		_timer = new GameTimer();
		_sceneManager = new SceneManager();
	}
Exemple #24
0
 private void CreateScorePanel(GameManager.LevelScore levelScore)
 {
     var spi = Instantiate(ScorePanelItemPrefab);
     spi.GetComponentInChildren<Text>().text = string.Format("Level {0}{3}Score: {1}{3}Faults: {4}{3}{2}",
         levelScore.LevelNumber, levelScore.Score, levelScore.Time.Minutes+"m " + levelScore.Time.Seconds + "s " + levelScore.Time.Milliseconds + "ms", Environment.NewLine, levelScore.Faults);
     spi.transform.SetParent(ScoresPanel);
 }
	private void Init(){
		this.gameManager = GameObject.Find ("GameManager").GetComponent<GameManager> ();
		this.player = GameObject.Find ("Player").GetComponent<PlayerScript> ();
		this.enemy = GameObject.Find ("Enemy").GetComponent<EnemyScript> ();
		this.mPlayerShieldHP = Constants.ShieldPoint;
		this.mEnemyShieldHP = Constants.ShieldPoint;
	}
    // tile map
    public TileMapData(int x_size, int y_size)
    {
        this.size_x = x_size;
        this.size_y = y_size;

        map_tiles = new DTile[size_x, size_y];

        // gameManager Stuff
        go = GameObject.Find("GameManager(Clone)");
        gameManagerScript = go.GetComponent<GameManager>();

         //   Debug.Log("ITs not null");

        // Construct Data map with Tiles from XML

        // Example without XML
        for (int x = 0; x < size_x; x++)
        {
            for (int y = 0; y < size_y; y++)
            {
                map_tiles[x, y] = new DBuildTile(x, y);
            }
        }

        if (gameManagerScript.getWaypoints() != null) {
            List<Vector2> wayPointsList = gameManagerScript.getWaypoints();
            // add path to tile
        //    Debug.Log("Starting Pathing");
            int mini;
            int maxi;
            for (int i = 0; i < wayPointsList.Count - 1; i++)
            {
                Vector2 current = wayPointsList[i];
                Vector2 next = wayPointsList[i + 1];
                // vertical
                if (current.x == next.x)
                {
                    // loop from start to next mark path tile
                    int x = (int)current.x;
                    mini = Mathf.Min((int)current.y, (int)next.y);
                    maxi = Mathf.Max((int)current.y, (int)next.y);
                    for (int y = mini; y < maxi + 1; y++)
                    {
                        map_tiles[x, y] = new DWalkableTile(x, y);
                    }
                }
                // horizontal
                else {
                    int y = (int)current.y;
                    mini = Mathf.Min((int)current.x, (int)next.x);
                    maxi = Mathf.Max((int)current.x, (int)next.x);
                    // loop from start to next mark
                    for (int x = mini; x < maxi + 1; x++)
                    {
                        map_tiles[x, y] = new DWalkableTile(x, y);
                    }
                }
            }
        }
    }
Exemple #27
0
 void Awake()
 {
     if (instance == null)
         instance = this;
     else if(instance != this)
         Destroy(gameObject);
 }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        gm = FindObjectOfType<GameManager>();

        rigidbody = GetComponent<Rigidbody2D>();
        ResetBall();
    }
Exemple #29
0
	void Awake ()
	{
		onFire = false;
		announcerAudio = GetComponents<AudioSource> () [1];
		playerAttack = GetComponent<PlayerAttack> ();

		canvas = GameObject.Find ("HUDCanvas");
		//Debug.Log ("PlayerHealthUI_" + playerAttack.playerNum);

		inGameHealthUI = canvas.GetComponent<RectTransform> ().Find ("PlayerHealthUI_" + playerAttack.playerNum)
			.GetComponent<InGameHealthUI>();
		inGameHealthUI.playerHealth = this;
		rigid = GetComponent<Rigidbody> ();
		gm = GameObject.Find ("GameManager").GetComponent<GameManager> ();
		uim = GameObject.Find ("GameManager").GetComponent<UI_Manager> ();
		joystickNum = playerAttack.joystickNum;
		damageReduction = 1;
		allgrounds = GameObject.FindGameObjectsWithTag("Island");
		anim = GetComponent <Animation> ();
		playerAudio = GetComponent <AudioSource> ();
		playerMovement = GetComponent <PlayerMovement> ();

		//playerShooting = GetComponentInChildren <PlayerShooting> ();
		currentHealth = startingHealth;
		SetupHealthUI ();
	}
	void Awake() {
		if (instance == null)
			instance = this;
		else if (instance != this)
			Destroy (gameObject);

		DontDestroyOnLoad (gameObject);

		tileL = new List<HexTile> ();
		playerL = new List<Unit> ();
		enemyL = new List<Enemy> ();
		battleAnimation = new int[10];

		xpGrowthRate = this.gameObject.GetComponent<XpGrowthRate> ();
		playerInput = this.gameObject.GetComponent<PlayerKeyBoardInput> ();

		PauseUI.SetActive (false);
		TurnUI.SetActive (false);
		StatsUI.SetActive (false);
		StoryUI.SetActive (false);
		InvUI.GetComponent<InventoryManager> ().CreateDefault ();

		level = 0;
		inLevel = false;
		State = 0;
	}
Exemple #31
0
 private void Awake()
 {
     instance = this;
     LoadLevel(MainManager.instance.CurrentSelectMapId.ToString());
     LoadCharacter(MainManager.instance.CharacterList[MainManager.instance.CurrentSelectCharacterId]);
 }
Exemple #32
0
 // Use this for initialization
 void Start()
 {
     gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
 }
Exemple #33
0
 private void Awake()
 {
     Instance = this;
 }
Exemple #34
0
 void Start()
 {
     GameManager.GetInstance().SetUIManager(this);
 }
Exemple #35
0
    IEnumerator Next5Waves(int waveNumber)
    {
        // wave 1, 6, 11, 16...
//		StartCoroutine(StartWave (0, 0, 0, 0, 50));
        ChooseEnemiesQty(waveNumber);
        wave1Instance = Instantiate(wave1) as GameObject;
        currentMusic  = wave1Instance;
        StartCoroutine(GameManager.DisplayWaveNumber(waveNumber));
        while (totalEnemies != 0 || enemiesToProduce != 0)
        {
            yield return(new WaitForSeconds(1));
        }
        // break between waves
        wave1Instance.GetComponent <AudioSource>().Stop();
        Destroy(wave1Instance);
        yield return(new WaitForSeconds(6));

        // wave 2, 7, 12, 17...
//		StartCoroutine(StartWave (3, 0, 0, 10, 1));
        ChooseEnemiesQty(++waveNumber);
        wave2Instance = Instantiate(wave2) as GameObject;
        currentMusic  = wave2Instance;
        StartCoroutine(GameManager.DisplayWaveNumber(waveNumber));
        while (totalEnemies != 0 || enemiesToProduce != 0)
        {
            yield return(new WaitForSeconds(1));
        }
        // break between waves
        wave2Instance.GetComponent <AudioSource>().Stop();
        Destroy(wave2Instance);
        yield return(new WaitForSeconds(6));

        // wave 3, 8, 13, 18...
//		StartCoroutine(StartWave (5, 0, 4, 6, 3));
        ChooseEnemiesQty(++waveNumber);
        wave3Instance = Instantiate(wave3) as GameObject;
        currentMusic  = wave3Instance;
        StartCoroutine(GameManager.DisplayWaveNumber(waveNumber));
        while (totalEnemies != 0 || enemiesToProduce != 0)
        {
            yield return(new WaitForSeconds(1));
        }
        // break between waves
        wave3Instance.GetComponent <AudioSource>().Stop();
        Destroy(wave3Instance);
        yield return(new WaitForSeconds(6));

        // wave 4, 9, 14, 19...
//		StartCoroutine(StartWave (3, 0, 5, 5, 4));
        ChooseEnemiesQty(++waveNumber);
        wave4Instance = Instantiate(wave4) as GameObject;
        currentMusic  = wave4Instance;
        StartCoroutine(GameManager.DisplayWaveNumber(waveNumber));
        while (totalEnemies != 0 || enemiesToProduce != 0)
        {
            yield return(new WaitForSeconds(1));
        }
        wave4Instance.GetComponent <AudioSource>().Stop();
        Destroy(wave4Instance);
        yield return(new WaitForSeconds(6));

        // wave 5, 10, 15, 20...
//		StartCoroutine(StartWave (0, 1, 0, 0, 0));
        ChooseEnemiesQty(++waveNumber);
        wave5Instance = Instantiate(wave5) as GameObject;
        currentMusic  = wave5Instance;
        StartCoroutine(GameManager.DisplayWaveNumber(waveNumber));
        while (totalEnemies != 0 || enemiesToProduce != 0)
        {
            yield return(new WaitForSeconds(1));
        }
        // break between waves
        wave5Instance.GetComponent <AudioSource>().Stop();
        Destroy(wave5Instance);
        yield return(new WaitForSeconds(6));

        // start again until player dies
        StartCoroutine(Next5Waves(++waveNumber));
    }
 private void Awake()
 {
     _gameManager = Object.FindObjectOfType <GameManager>();
 }
Exemple #37
0
        public void Setup()
        {
            var go = new GameObject();

            gameManager = go.AddComponent <GameManager>();
        }
Exemple #38
0
 private void CreateGameManagerInstance()
 {
     _gm = new GameManager();
     _gm.Start();
 }
 public MarinusGame(GameManager gameManager)
 {
     Initialize(gameManager);
     map = new MarinusMap(this, gameManager.gameType, dim, dim, wrapEastWest, wrapNorthSouth, percentSea, percentRiver);
 }
 public void Initialize(GameManager _gameManager)
 {
     gameManager = _gameManager;
     dim = gameManager.dim;
     tick = 0;
 }
Exemple #41
0
 public virtual void OnUnpause(GameManager gameManager)
 {
 }
Exemple #42
0
 public virtual void OnEnter(GameManager gameManager)
 {
 }
Exemple #43
0
 public virtual void OnExit(GameManager gameManager)
 {
 }
Exemple #44
0
 public virtual void OnUpdate(GameManager gameManager)
 {
 }
Exemple #45
0
 private void Start()
 {
     _gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
 }
    void Start()
    {
        // targetAngle = this.transform.rotation;

        rGM = FindObjectOfType <GameManager>();
    }
Exemple #47
0
 void Awake()
 {
     _gameManager = GameManager._GameManager;
 }
Exemple #48
0
    // Start is called before the first frame update
    void Start()
    {
        int stage = GameManager.GetInstance().stage;

        LoadMap(stage);
    }
Exemple #49
0
 void Start()
 {
     gm         = GameObject.FindWithTag("GM").GetComponent <GameManager>();
     scoreValue = gm.score; //Sets the scoreValue to the game manager float score.
 }
 void Start()
 {
     GM = GameManager.instance;
     GM.Players.Add(this);
 }
    }                                          //taka sama sytuacja jak wyżej

    void Awake()
    {
        Instance = this; //tutaj pojawia się pierwsze wywołanie instancji GameManager
    }
 // Start is called before the first frame update
 void Start()
 {
     gm = FindObjectOfType <GameManager>();
     Cursor.lockState = CursorLockMode.Locked;
     anim             = GetComponent <Animator>();
 }
Exemple #53
0
 public void OnClickStartButton()
 {
     SetUIState(GameManager.state.Play);
     GameManager.GetInstance().SetState(GameManager.state.Play);
 }
Exemple #54
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     _instance = this;
 }
Exemple #55
0
 // Start is called before the first frame update
 void Start()
 {
     gameManager  = GameObject.Find("Game Manager").GetComponent <GameManager>();
     target       = GameObject.Find("Player").transform;
     projectileRb = GetComponent <Rigidbody2D>();
 }
 void DesactivarPanel()
 {
     GameManager.GetInstance().pausa = false;
     panel.SetActive(false);
 }
 private void Start()
 {
     gameManager = FindObjectOfType <GameManager>();
     player      = GameObject.FindWithTag("Player");
 }
Exemple #58
0
 void Start()
 {
     coll = GetComponent <Collider2D>();
     gm   = GameObject.FindWithTag("GameController").GetComponent <GameManager>();
     gm.WorldColorChange += OnWorldColorChange;
 }
Exemple #59
0
 private void OnDestroy()
 {
     Instance = null;
 }
 void OnTriggerEnter(Collider col)
 {
     _gm = FindObjectOfType <GameManager>();
     _gm.SwitchState(new GameStateEndGame(_gm));
 }