Пример #1
0
 void Start()
 {
     gameOver = false;
     player = GameObject.FindGameObjectWithTag("Player");
     controller = GameObject.Find("GameController").GetComponent<GameControlScript>();
     gameOverPanel.SetActive (false);
 }
Пример #2
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameControlScript");

        Debug.Log(gameControllerObject);
        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameControlScript>();
            Debug.Log("found game control");
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }

        GameObject pauseObject = GameObject.FindWithTag("PauseMainScene");

        if (pauseObject != null)
        {
            pause = pauseObject.GetComponent <PauseMainScene>();
        }
        if (pauseObject == null)
        {
            Debug.Log("Cannot find 'pauseObject' script");
        }
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     control    = GameObject.Find("GameControl").GetComponent <GameControlScript>();
     throwAudio = gameObject.AddComponent <AudioSource>();
     ableBomb   = true;
     ableDirt   = true;
 }
Пример #4
0
    void Start()
    {
        rigidbody = GetComponent <Rigidbody>();

        gameControlObject = GameObject.FindGameObjectWithTag("GameController");
        gameControl       = gameControlObject.GetComponent <GameControlScript>();
    }
Пример #5
0
    private void OnMouseDown()
    {
        theGameController   = GameObject.Find("GameController");
        theControllerScript = theGameController.GetComponent <GameControlScript>();
        myGameObject        = GameObject.Find("Canvas/Tell the Player");
        myText = myGameObject.GetComponent <Text>();

        if (this.tag == "I")
        {
            if (theControllerScript.InventoryList.Count < 10)
            {
                theControllerScript.InventoryList.Add(name);
                addedItem = theControllerScript.InventoryList.Count;
                Destroy(gameObject);

                numToString       = addedItem.ToString();
                theInventoryItem += numToString;
                invGameObject     = GameObject.Find("Canvas/Panel/" + theInventoryItem);
                newItem           = invGameObject.GetComponent <Text>();
                newItem.text      = name;
            }
            else
            {
                myText.text += "\nYo man, I think I can only carry 10 things in these small pockets of mine. I feel like maybe I can get rid of them by shoving them into some puzzles. Am I seriously gonna have to break the 4th wall again? I'm just ripping off Dead Pool at this point.";
            }
        }
        else
        {
            myText.text += "\nThe " + this.name + " cannot be put in inventory";
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         GameControlScript.GotoNextLevel();// NextLevelStuff();
     }
 }
    // Use this for initialization
    void Start()
    {
        //Because this is instantiated, we must find the game control at run time
        m_gameControlScript = GameObject.Find("GameControl").GetComponent<GameControlScript>();

        rotation = Random.Range(-40, 40);
    }
 void Awake()
 {
     if (current == null)
         current = this;
     else if(current != this)
         Destroy (gameObject);
 }
 private void Start()
 {
     if (!gmCtrl)
     {
         gmCtrl = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControlScript>();
     }
 }
Пример #10
0
 void ReplaceBlocks(int x, int y, int XX, int YY)
 {
     GameControlScript.grid[x, y].transform.position = GameControlScript.position[XX, YY];
     GameControlScript.grid[XX, YY] = GameControlScript.grid[x, y];
     GameControlScript.grid[x, y]   = null;
     GameControlScript.GameFinish();
 }
Пример #11
0
    // Use this for initialization
    void Awake()
    {
        SetSelectedCharacter();
        isPlaying = false;
        selectCubeBttn.SetActive(true);
        healthText.text = "Health: " + health;
        coins           = 0;
        coinsText.text  = "Coins: " + coins;
        box             = GetComponent <BoxCollider> ();
        rend            = GetComponent <Renderer> ();
        myBody          = GetComponent <Rigidbody>();
        position        = transform.position;
        speed           = 10;

        alphaColor   = gameObject.GetComponent <MeshRenderer>().material.color;
        alphaColor.a = 0;

        cubeNumber        = 1;
        cubeRotationSpeed = EnemyCarMove.getSpeed() * 12f;

        control = GameObject.FindGameObjectWithTag("GameControl").GetComponent <GameControlScript>();

        controller = GetComponent <CharacterController> ();
        camera     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
    }
Пример #12
0
 public static void Initialize()
 {
     ballScript = GameObject.FindObjectOfType <Ball>();
     gcsScript  = GameObject.FindObjectOfType <GameControlScript>();
     ballGO     = ballScript.gameObject;
     flagGO     = GameObject.Find("Flag");
 }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     anim  = GetComponent <Animator> ();
     rb    = GetComponent <Rigidbody2D> ();
     audio = GetComponent <AudioSource> ();
     gcs   = GameObject.Find("GameControl").GetComponent <GameControlScript> ();
 }
    void Start()
    {
        if (!gmCtrl)
        {
            gmCtrl = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControlScript>();
        }

        enemySpeed = gmCtrl.speed; //setting it here so that if player gets a power down to speed it doesn't speed down the enemies
    }
Пример #15
0
 void Start()
 {
     gameControl = FindObjectOfType <GameControlScript>();
     npcHealth   = gameControl.GetNpcHealth();
     npcDamage   = gameControl.GetNpcDamage();
     npcSpeed    = gameControl.GetNpcSpeed();
     npcPoints   = gameControl.GetNpcPoints();
     changerLane = 0f;
 }
Пример #16
0
 // for holding statistics
 void Awake()
 {
     if (control == null) {
         DontDestroyOnLoad (gameObject);
         control = this;
     }
     else if (control != this) {
         Destroy(gameObject);
     }
 }
Пример #17
0
 void Start()
 {
     gameControl = FindObjectOfType <GameControlScript>();
     npcHealth   = gameControl.GetNpcHealth();
     npcDamage   = gameControl.GetNpcDamage();
     npcSpeed    = gameControl.GetNpcSpeed();
     npcPoints   = gameControl.GetNpcPoints();
     direction   = true;
     audio       = GetComponent <AudioSource>();
 }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     GC = GameController.GetComponent<GameControlScript>();
     if (GC == null)
     {
         Debug.Log("Game Controller is NULL.");
     }
     if (!FailOnTrigger)
         GC.RegisterTarget(this.gameObject, GameControlScript.TargetType.Destroy);
 }
Пример #19
0
	bool isGameOver = false;					//is the game over?


	void Awake()
	{
		//if we don't currently have a game control...
		if (current == null)
			//...set this one to be it...
			current = this;
		//...otherwise...
		else if(current != this)
			//...destroy this one because it is a duplicate
			Destroy (gameObject);
	}
Пример #20
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #21
0
 void Awake()
 {
     GameControlScript OG = GameObject.Find("GameController").GetComponent<GameControlScript>();
     if (instance != null && instance != this || OG.isOriginal && OG != this)
     {
         Destroy(gameObject);
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
     isOriginal = true;
 }
Пример #22
0
    // for holding statistics

    void Awake()
    {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }
        else if (control != this)
        {
            Destroy(gameObject);
        }
    }
Пример #23
0
 void Start()
 {
     StartZ             = transform.position.z;
     projectileCooldown = Time.timeSinceLevelLoad;
     anim          = GetComponent <Animator>();
     gameControl   = FindObjectOfType <GameControlScript>();
     audio         = GetComponent <AudioSource>();
     playerPrefs   = FindObjectOfType <PlayerPrefsControlScript>();
     audio.volume  = playerPrefs.GetSfXVolume();
     autoFire      = playerPrefs.GetAutoFire();
     accelerometer = playerPrefs.GetAccelerometer();
 }
Пример #24
0
    public static void SavePlayer(GameControlScript player)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string     path   = Application.persistentDataPath + "/player.fun";
        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Пример #25
0
    // Update is called once per frame
    void Update()
    {
        if (GameControlScript.getScore() == 0)
        {
            EnemyCarMove.setSpeed(20f);
            cubeController.setSpeed(10);
            cubeController.cubeRotationSpeed = EnemyCarMove.getSpeed() * 12f;
        }
        delayTimer -= Time.deltaTime;

        if (delayTimer < 0 && GameControlScript.getScore() % 25 == 0 && GameControlScript.getScore() > 1)
        {
            switch (stageNum)
            {
            case 1:
                sPlane.GetComponent <Renderer>().material = Stage2;
                break;

            case 2:
                sPlane.GetComponent <Renderer>().material = Stage3;
                break;

            case 3:
                sPlane.GetComponent <Renderer>().material = Stage4;
                break;

            case 4:
                sPlane.GetComponent <Renderer>().material = Stage5;
                break;

            case 5:
                sPlane.GetComponent <Renderer>().material = Stage6;
                break;

            case 6:
                sPlane.GetComponent <Renderer>().material = Stage1;
                stageNum = 0;
                break;
            }

            incrementSpeed();
            delayTimer = 3;
            totalStages++;
            stageNum++;
            greenCubeSpawner.stageChangeDelay();
            yellowCoinSpawner.stageChangeDelay();
            yellowCubeSpawner.stageChangeDelay();
            orangeCubeSpawner.stageChangeDelay();
            redCubeSpawner.stageChangeDelay();
            blueCubeSpawner.stageChangeDelay();
        }
    }
Пример #26
0
 // Update is called once per frame
 public void onUpdate()
 {
     //playerX = player.transform.position.x;
     if (spawning && globalSpawning && myCube != null)
     {
         timer += Time.deltaTime;
         if (timer > delayTimer && player != null && myCube != null && GameControlScript.isGameOver() != true)
         {
             spawnNewCube();
             timer = 0;
         }
     }
 }
Пример #27
0
    }                                               //游戏结束了没

    void Awake()
    {
        if (current == null)
        {
            current = this;
        }
        else if (current != this)
        {
            Destroy(gameObject);
        }

        gameLevel = 1;
    }
Пример #28
0
 // Use this for initialization
 void Start()
 {
     gameControl  = FindObjectOfType <GameControlScript>();
     playerPrefs  = FindObjectOfType <PlayerPrefsControlScript>();
     moverScript  = FindObjectOfType <NPCObstacle>();
     audio        = GetComponent <AudioSource>();
     audio.volume = playerPrefs.GetSfXVolume();
     player       = GameObject.FindGameObjectWithTag("Player");
     npcDamage    = gameControl.GetNpcDamage();
     npcHealth    = gameControl.GetNpcHealth();
     IsShooterAndMaterial();
     DestroyGlitchedObject();
 }
Пример #29
0
    void Awake()
    {
        explosionParent   = GameObject.Find("Explosions");
        gameControlScript = GameObject.Find("GameController").GetComponent <GameControlScript>();

        healthBarParent = GameObject.Find("HealthBars");

        healthBar = Instantiate(healthBarPrefab, transform.position + new Vector3(0f, healthBarHeight, 0f), Quaternion.Euler(40f, 60f, 0f));
        healthBar.transform.SetParent(healthBarParent.transform);
        healthBarScript = healthBar.GetComponent <Slider>();

        initialHealth = health;
    }
Пример #30
0
 // Update is called once per frame
 void Update()
 {
     transform.Rotate(new Vector3(rotationSpeed, 0f, 0f) * Time.deltaTime);
     //	speed += 0.02f;
     if (GameControlScript.getScore() == 0)
     {
         rotationSpeed = Random.Range(180f, 220f);
     }
     if (GameControlScript.isGameOver() == true)
     {
         rotationSpeed = 0f;
     }
 }
Пример #31
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     isGameOn       = true;
     Time.timeScale = 1;
     isGameOver     = false;
 }
Пример #32
0
 void Awake()
 {
     //if we dont have a game control
     if (current == null)
     {
         //set this one to be it
         current = this;
     }
     else if (current != this)
     {
         //destroy this one because it is a duplicate
         Destroy(gameObject);
     }
 }
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        texto_perder.gameObject.SetActive(false);
        texto_ganar.gameObject.SetActive(false);
    }
    bool isGameOver = false;                            //is the game over?


    void Awake()
    {
        //if we don't currently have a game control...
        if (current == null)
        {
            //...set this one to be it...
            current = this;
        }
        //...otherwise...
        else if (current != this)
        {
            //...destroy this one because it is a duplicate
            Destroy(gameObject);
        }
    }
Пример #35
0
    public void rotateCamera()
    {
        camAngle *= Mathf.Pow(.99f, Time.deltaTime * (1000 - speed * 10));

        if (!GameControlScript.isGameOver() && camAngle < speed && camAngle > -speed)
        {
            camAngle += Input.GetAxis("Horizontal") * -1;
        }
        if (GameControlScript.isGameOver())
        {
            camAngle *= Mathf.Pow(.99f, Time.deltaTime * 100);
        }

        camera.transform.eulerAngles = new Vector3(camera.transform.eulerAngles.x, 0f, camAngle);
    }
Пример #36
0
	void Start () {
		if (!GameManager.Instance.bGameLogin) {
			SceneManager.LoadScene ("Title");
			return;
		}
		SetObject ();
		m_sBackLoop = GameData.FindChild (this.transform, "Frest").GetComponent<BackLoop> ();
		m_sGameControl = m_oCamera.transform.FindChild ("GameControl").GetComponent<GameControlScript> ();
		m_sPlayer = m_oCamera.transform.FindChild ("Player").GetComponent<PlayerScript> ();
		m_sGameUi = m_oCamera.transform.FindChild ("PanelUi").GetComponent<GameUiScript> ();
		m_sBackLoop.SetManager (this);
		m_sGameControl.SetManager (this);
		m_sPlayer.SetManager (this);
		m_sGameUi.SetManager (this);
	}
Пример #37
0
    public void rotateCamera()
    {
        camAngle *= Mathf.Pow(.9f + Mathf.Clamp(StageChange.getTotalStages(), 0, 9) / 10, Time.deltaTime * (1000));

        if (!GameControlScript.isGameOver() && camAngle < speed && camAngle > -speed)
        {
            camAngle += Input.GetAxis("Horizontal") * -1;
        }
        if (GameControlScript.isGameOver())
        {
            camAngle *= Mathf.Pow(.99f, Time.deltaTime * 100);
        }

        camera.transform.eulerAngles = new Vector3(camera.transform.eulerAngles.x, camera.transform.eulerAngles.y, camAngle);
    }
    bool noMovingCans;                                         // to check if all af the cans are not moving

    // Use this for initialization
    void Start()
    {
        // creating an instance of GameControl which is Singletone
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        // turn off Win and Lose signs
        youLoseText.gameObject.SetActive(false);
        youWinText.gameObject.SetActive(false);
    }
Пример #39
0
    // Use this for initialization
    void Start()
    {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);

            currentControls = (int)controlOptions.RightHanded;
            currentDifficulty = (int)difficultyOptions.Easy;
            control = this;

            //Hello

        } else if(control != this)
        {
            Destroy(gameObject);
        }
    }
 // Use this for initialization
 void Start()
 {
     gameControlScript = GameObject.FindGameObjectWithTag("GameControllerObject").GetComponent<GameControlScript>();
 }
 // @author: Craig Broskow
 // Use this for initialization
 void Start()
 {
     gameControlScript = GameObject.FindGameObjectWithTag("GameControllerObject").GetComponent<GameControlScript>();
     diceRollPanel = GameObject.Find("DiceRollPanel");
     DisplayDiceRoll(false);
     DisplayVictoryMessage(false);
     DisplayLossMessage(false);
     DisablePhaseNumbers();
     if (HelperScript.playerName != null && HelperScript.playerName.Length > 0)
         playerName.text = HelperScript.playerName.ToString();
     else
         playerName.text = "Guest Player";
 }
Пример #42
0
 void Start()
 {
     // initialising reference variables
     anim = GetComponent<Animator>();
     controlScript = GameObject.Find("GameControl").GetComponent<GameControlScript>();
     player = GameObject.Find("Jack");
     pScript = player.GetComponent<PlayerControlScript>();
     if( transform.position.z < player.transform.position.z)
         isRunningLeft = false;
 }
Пример #43
0
 //----------------------------------------------------------------------------------------------------
 // SetGameControlScript - to be called from GameControlScript
 //----------------------------------------------------------------------------------------------------
 public void SetGameControlScript(GameControlScript gcs)
 {
     m_gameControlScript = gcs;
 }
    void Awake()
    {
        gcs = target as GameControlScript;

        if (GameControlScript.control == null) {
            GameControlScript.control = gcs;
        }
    }
Пример #45
0
    public void initValues()
    {
        gameControl = GameObject.Find("GameControl").GetComponent<GameControlScript>();
        nextTime = 1.0f;
        score = 0;

        controlUpStyle = new GUIStyle();
        controlUpStyle.normal.background = controlUpButton;

        controlDownStyle = new GUIStyle();
        controlDownStyle.normal.background = controlDownButton;

        controlLeftStyle = new GUIStyle();
        controlLeftStyle.normal.background = controlLeftButton;

        controlRightStyle = new GUIStyle();
        controlRightStyle.normal.background = controlRightButton;

        if (gameControl.currentDifficulty == 0)
        {
            interval = 0.325f;
            scorePerDot = 50;
            scorePerSec = 1;
        } else if (gameControl.currentDifficulty == 1)
        {
            interval = 0.225f;
            scorePerDot = 100;
            scorePerSec = 2;
        } else if (gameControl.currentDifficulty == 2)
        {
            interval = 0.15f;
            scorePerDot = 200;
            scorePerSec = 5;
        }
    }
Пример #46
0
 void Start()
 {
     control = GetComponent<GameControlScript>();
 }
Пример #47
0
 // Use this for initialization
 void Start()
 {
     gameControl = GameObject.Find("GameControl").GetComponent<GameControlScript>();
 }
Пример #48
0
    void Start()
    {
        controlReference = GameControlScript.control;
        managerReference = controlReference.Manager;

        InitializeFight();
        GenerateTeamsGameObjects();

        Debug.Log("Fight Beginning...\n" + Fight.Alpha.DebugInfo() + "\n" + Fight.Beta.DebugInfo());
        Fight.PostStepUpdate += onTeamUpdate;
        Fight.FoundWinner += onFoundWinner;

        if (StatBoard != null)
        {
            GameObject board = Instantiate<GameObject>(StatBoard);

            board.transform.SetParent(transform);

            if (TextPrefab != null)
            {
                AlphaTextObject = Instantiate<GameObject>(TextPrefab);
                AlphaTextObject.name = "AlphaTeamText";
                AlphaTextObject.transform.SetParent(board.transform);
                AlphaTextObject.transform.localPosition = new Vector3(-200, -50, 0);

                BetaTextObject = Instantiate<GameObject>(TextPrefab);
                BetaTextObject.name = "BetaTeamText";
                BetaTextObject.transform.SetParent(board.transform);
                BetaTextObject.transform.localPosition = new Vector3(100, -50, 0);
            }
        }
    }