상속: MonoBehaviour
예제 #1
0
	void Awake ()
	{
		if (Instance){
			Destroy(gameObject);
		} else {
			DontDestroyOnLoad(gameObject);
			Instance = this;
		}
		//Check PlayerPrefs to see if the three main things are saved. If not, set them to default levels.
		if(PlayerPrefs.HasKey("Score")){
			score = PlayerPrefs.GetFloat("Score");
		} else{
			score = 0;
		}
		if(PlayerPrefs.HasKey("CurrentUnlockedLevel")){
			currentUnlockedLevel = PlayerPrefs.GetInt("CurrentUnlockedLevel");
		} else{
			currentUnlockedLevel = 10;
		}
		if(PlayerPrefs.HasKey("CurrentLevel")){
			currentLevel = PlayerPrefs.GetInt("CurrentLevel");
		} else {
			currentLevel = 0;
		}
		if(PlayerPrefs.HasKey("Vibrations")){
			vibrations = PlayerPrefs.GetInt("Vibrations");
		} else {
			vibrations = 1;
		}
		ih = (InputHandler)gameObject.GetComponent(typeof(InputHandler));
	}
예제 #2
0
	public override void Start ()
    {
		base.Start();
		setMainText();
		GameObject gc = GameObject.FindGameObjectWithTag ("GameController");
		gcs = (GameControllerScript)gc.GetComponent (typeof(GameControllerScript));
    }
예제 #3
0
	void Start ()
	{
		volStyle = new GUIStyle();
		volStyle.alignment = TextAnchor.LowerCenter;
		volStyle.fontStyle = FontStyle.BoldAndItalic;
		allSources = new AudioSource[3]{mainTheme, level1, endCredits};
		gcScript = (GameControllerScript) GameObject.FindGameObjectWithTag ("GameController").GetComponent(typeof(GameControllerScript));
	}
예제 #4
0
 // Start is called before the first frame update
 void Start()
 {
     gc    = GameObject.Find("GameController").GetComponent <GameControllerScript>();
     rb    = gameObject.GetComponent <Rigidbody2D>();
     sr    = gameObject.GetComponent <SpriteRenderer>();
     tr    = gameObject.GetComponentInChildren <TrailRenderer>();
     audio = GetComponent <AudioSource>();
     ResetVelocity();
 }
예제 #5
0
 // Start is called before the first frame update
 void Start()
 {
     game   = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerScript>();
     source = GetComponent <AudioSource>();
     if (autoPlayQueue)
     {
         StartCoroutine(PlayNextInQueue(0, mustPlayIndependent));
     }
 }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     gcs               = gameController.GetComponent <GameControllerScript> ();
     playerHand        = new List <Card> ();
     cardsInPlay       = new List <Card> ();
     playerHandPrefabs = new List <GameObject> ();
     txtNames          = new List <Text> ();
     txtDescriptions   = new List <Text> ();
 }
    //Update the player input from parent
    void UpdateButtons()
    {
        GameControllerScript gameControllerScript = GameObject.FindObjectOfType <GameControllerScript>();

        crouchButton = gameControllerScript.crouchButton;
        dashButton   = gameControllerScript.dashButton;
        horizontal   = gameControllerScript.horizontal;
        vertical     = gameControllerScript.vertical;
    }
 // Start is called before the first frame update
 void Start()
 {
     Instance = this;
     this.startButton.onClick.AddListener(() =>
     {
         this.menuScreen.SetActive(false);
         this.IsStarted = true;
     });
 }
예제 #9
0
    void OnCollisionEnter(Collision col)
    {
        GameControllerScript.PlaySound(3);
        //if its the ball in level4, roll it
        if (col.gameObject.name == "lvl4ball")
        {
            col.gameObject.GetComponent <Rigidbody> ().isKinematic = false;
            //gameObject.GetComponent<Collider> ().isTrigger = true;
            col.gameObject.GetComponent <Rigidbody> ().AddForce(gameObject.GetComponent <Rigidbody> ().velocity.normalized * 700);
            return;
        }

        /*
         * if (col.gameObject.name.Length >= 6 && col.gameObject.name.Substring (0, 6) == "Sphere") {
         *      col.gameObject.GetComponent<Rigidbody> ().isKinematic = false;
         *      Vector3 ve = (-transform.position + col.gameObject.transform.position);//gameObject.GetComponent<Rigidbody> ().velocity;
         *      ve.y = 0;
         *      col.gameObject.GetComponent<Rigidbody> ().AddForce (ve * 60);
         *      return;
         * }
         */
        //if its a subitem, add a force to its rigidbody
        if (col.gameObject.CompareTag("SubItem"))
        {
            if (col.gameObject.name.Length >= 6 && col.gameObject.name.Substring(0, 6) == "Domino")
            {
                col.gameObject.GetComponent <Rigidbody> ().AddForce(gameObject.GetComponent <Rigidbody> ().velocity.normalized * 10);
            }
            else if (col.gameObject.GetComponent <Rigidbody> () != null)
            {
                if (col.gameObject.GetComponent <Rigidbody> ().isKinematic == true)
                {
                    col.gameObject.GetComponent <Rigidbody> ().isKinematic = false;
                    if (col.gameObject.name.Substring(0, 5) == "Panel")
                    {
                        col.gameObject.GetComponent <Rigidbody> ().AddForce(gameObject.GetComponent <Rigidbody> ().velocity.normalized * 10);
                    }
                    else if (col.gameObject.name.Substring(0, 6) == "Sphere")
                    {
                        col.gameObject.GetComponent <Rigidbody> ().isKinematic = false;
                        Vector3 ve = (-transform.position + col.gameObject.transform.position - gameObject.GetComponent <Rigidbody> ().velocity.normalized);                       //gameObject.GetComponent<Rigidbody> ().velocity;
                        ve.y = 0;
                        col.gameObject.GetComponent <Rigidbody> ().AddForce(ve * 90);
                    }
                    else if (col.gameObject.name.Substring(0, 8) == "Cylinder")
                    {
                        gameObject.GetComponent <Collider> ().isTrigger = true;
                        col.gameObject.GetComponent <Rigidbody> ().AddRelativeForce(Vector3.left * 30);
                    }
                }
            }
        }
        else if (gameObject.CompareTag("SubItem") && col.gameObject.name.Length >= 6 && col.gameObject.name.Substring(0, 6) == "Domino")
        {
            col.gameObject.GetComponent <Rigidbody> ().AddForce(gameObject.GetComponent <Rigidbody> ().velocity.normalized * 10);
        }
    }
예제 #10
0
    public bool isStarted = false; // изначально игра не запущена

    // Start is called before the first frame update
    void Start()
    {
        instance = this;
        startButton.onClick.AddListener(delegate
        {
            menu.gameObject.SetActive(false);
            isStarted = true;
        });
    }
예제 #11
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //change score
        // += 1;
        GameControllerScript gameControllerScript = gameControl.GetComponent <GameControllerScript>();

        gameControllerScript.Score += 1;
        Destroy(gameObject);
    }
예제 #12
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.name == "Bullet(Clone)")
     {
         Debug.Log("collide with good message");
         GameControllerScript.ReduceLife(1);
         Destroy(this.gameObject);
     }
 }
예제 #13
0
	void Start() {
		GameObject gameControllerObject = GameObject.FindWithTag ("GameController");
		if (gameControllerObject != null) {
			gameController = gameControllerObject.GetComponent<GameControllerScript> ();
		}
		if (gameController == null) {
			Debug.Log ("Not found!!!");
		}
	}
예제 #14
0
    void Start()
    {
        GameControllerInstance = this;
        InputText = InputTextPrefab.GetComponent <TMP_InputField>();

        Words = SaveFileHandler.ReturnWordsList();

        StartGame();
    }
    // Start is called before the first frame update
    void Start()
    {
        //Вылет истребителей союзника
        InvokeRepeating("TakeOff", delayFirstAllyTakeOff, Random.Range(minTimeTakeOffDelay, maxTimeTakeOffDelay));

        // Подключаем GameControllerScript
        gameControllerScript = GameObject.FindGameObjectWithTag("GameController").
                               GetComponent <GameControllerScript>();
    }
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameControllerScript = gameControllerObject.GetComponent <GameControllerScript> ();
        }
    }
예제 #17
0
    // Use this for initialization
    void Start()
    {
        spawnPoint = transform.position;  // Set initial position as spawnPoint.

        gameControllerScript = gameController.GetComponent <GameControllerScript>();
        soundFX = GetComponents <AudioSource>();
        sound1  = soundFX[0];
        sound2  = soundFX[1];
    }
예제 #18
0
    PlayerScript script; //PlayerScriptが入る変数

    void Start()
    {
        nearObj        = serchTag(gameObject, "Enemy");
        gameController = GameObject
                         .FindWithTag("GameController") //GameControllerを探すため
                         .GetComponent <GameControllerScript>();
        Player = GameObject.Find("Player");             //Playerをオブジェクトの名前から取得して変数に格納する
        script = Player.GetComponent <PlayerScript>();  //Playerの中にあるPlayerScriptを取得して変数に格納する
    }
예제 #19
0
    private void OnTriggerEnter(Collider other)
    {
        GameControllerScript gameControllerScript = GameControllerObject.GetComponent <GameControllerScript>();

        if (other.tag == "Ball" && countsOnce && !connected)
        {
            countsOnce = false;
            if (noHole)
            {
                if (!gameControllerScript.gameEnded)
                {
                    gameControllerScript.rowsPassed += 1;
                }
            }
            else
            {
                if (!gameControllerScript.boosting)
                {
                    gameControllerScript.SnapPoint = SnapPoint;
                    gameControllerScript.gameEnded = true;
                    foreach (HoleColliderScript s in connectedColliders)
                    {
                        s.countsOnce = false;
                    }
                }
                else
                {
                    gameControllerScript.rowsPassed += 1;
                }
            }
        }

        if (other.tag == "Ball" && connected)
        {
            Debug.Log("Touch connect collider");
            if (connectedCollider.GetComponent <HoleColliderScript>().countsOnce)
            {
                Debug.Log("in if statement");
                countsOnce = false;
                connectedCollider.GetComponent <HoleColliderScript>().countsOnce = false;

                if (!gameControllerScript.gameEnded)
                {
                    if (!gameControllerScript.boosting)
                    {
                        gameControllerScript.SnapPoint = SnapPoint;
                        gameControllerScript.gameEnded = true;
                    }
                    else
                    {
                        gameControllerScript.rowsPassed += 1;
                    }
                }
            }
        }
    }
예제 #20
0
 public void increaseThreatEmptyBar()
 {
     if (CurrentThreat == 7)
     {
         GameControllerScript g = toController.GetComponent <GameControllerScript>();
         g.GameOver();
     }
     CurrentThreat++;
     FadeToRed();
 }
예제 #21
0
 public void Initialize(int x, int y, int z, GameControllerScript gameScript)
 {
     this.scale = gameScript.scale;
     this.yOffset = gameScript.yOffset;
     this.gameScript = gameScript;
     this.x = x;
     this.y = y;
     this.z = z;
     this.originalPosition = new Vector3(x * this.scale, y * this.scale + this.yOffset, z * this.scale);
 }
예제 #22
0
    //create new free build
    public void LoadScene()
    {
        GameControllerScript.PlaySound(4);
        string txtName = GetComponent <InputField> ().text;

        txtName = Application.persistentDataPath + "/" + txtName + ".dat";

        GameControllerScript.fileName = txtName;
        GameControllerScript.LoadAndSetUp();
    }
예제 #23
0
    void Start()
    {
        m_gc           = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_alert        = GameObject.FindWithTag("GameController").GetComponent <AlertScript>();
        m_pointsSystem = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();

        m_player = GameObject.FindWithTag("Player");

        InvokeRepeating("SpawnWave", 2, 6);
    }
예제 #24
0
    // Use this for initialization
    void Start()
    {
        timerTick = 5.0f;
        m_Level   = GameObject.Find("Main Camera").GetComponent <LevelLoader>();            // Level Obj
        m_Player  = GameObject.Find("CaveMan").GetComponent <player>();                     // Player Obj
        m_Cow     = GameObject.Find("Cow(Clone)");                                          // Cow Obj
        m_Control = GameObject.Find("GameControl").GetComponent <GameControllerScript>();   // Score

        ChoosePatrolState();
    }
예제 #25
0
 // Start is called before the first frame update
 void Start()
 {
     if (staticInstance != null)
     {
         Destroy(staticInstance.gameObject);
     }
     staticInstance = this;
     queue          = new Queue <ProjectileBehavior>();
     timer          = 0f;
 }
예제 #26
0
    public GameObject downedAlly; // Сбитый летчик



    // Start is called before the first frame update
    void Start()
    {
        //GetComponent<Rigidbody>().velocity = Vector3.back*speed;

        GetComponent <Rigidbody>().velocity = transform.forward * speed;

        gameControllerScript =
            GameObject.FindGameObjectWithTag("GameController").
            GetComponent <GameControllerScript>();
    }
예제 #27
0
    public override void RespondToInput(GameControllerScript controller, string[] separateInputWords)
    {
        Dictionary <string, string> takeDictionary = controller.useableItems.Take(separateInputWords);

        if (takeDictionary != null)
        {
            controller.LogStringWithReturn(controller.TestVerbDictionaryWithNoun(takeDictionary, separateInputWords[0],
                                                                                 separateInputWords[1]));
        }
    }
 // Update is called once per second
 void Awake()
 {
     GameObject gameControllerObject = GameObject.FindGameObjectWithTag ("GameController");
     if (gameControllerObject != null) {
         gameController = gameControllerObject.GetComponent <GameControllerScript>();
     }
     if (gameController == null) {
         Debug.Log ("Cannot find 'GameController' script");
     }
 }
예제 #29
0
 public override void StartEvent(GameControllerScript gameController)
 {
     enemySpawner                = GameObject.FindWithTag("Spawner").GetComponent <EnemySpawner>();
     this.gameController         = gameController;
     this.gameController.isEvent = true;
     isGoing = true;
     enemySpawner.StopAllCoroutines();
     enemySpawner.StartCoroutine(enemySpawner.SpawnDelay(enemy, Random.Range(minSpawnDelay, maxSpawnDelay)));
     Invoke("StopEvent", duration);
 }
    // Start is called before the first frame update
    void Start()
    {
        controller = FindObjectOfType <GameControllerScript>();

        // if we have a teleport-to object, tp there
        if (TeleportToObject != null)
        {
            TeleportTo = TeleportToObject.transform.position;
        }
    }
예제 #31
0
 void Update()
 {
     if (activated)
     {
     }
     else
     {
         activated = GameControllerScript.differenceAlongDirection(transform.position, play.transform.position, PlayerScript.currentDirection) < 20;
     }
 }
예제 #32
0
    // Update is called once per frame
    void Update()
    {
        GameObject           go    = GameObject.Find("Game Controller");
        GameControllerScript other = (GameControllerScript)go.GetComponent <GameControllerScript>();

        if (!other.isOver())
        {
            LifeTime();
        }
    }
예제 #33
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
    }
 public void SetPlayer(int[] xy, float _speed, GameControllerScript _gameController, GridScript _gridScript)
 {
     posX           = xy[0];
     posY           = xy[1];
     speed          = _speed;
     inMove         = false;
     rectTransform  = gameObject.GetComponent <RectTransform>();
     gameController = _gameController;
     gridScript     = _gridScript;
 }
예제 #35
0
    void Start()
    {
        spawning = true;
        wave     = 0;
        maxWave  = 3;
        combo    = 1;
        streak   = 0;

        SFX = GameObject.Find("SFXManager").GetComponent <SoundEffects>();
        gameControllerObj = GameObject.Find("GameController");

        if (gameControllerObj != null)
        {
            gameController = gameControllerObj.GetComponent <GameControllerScript>();
            bikeTier       = gameController.bikeTier;

            if (bikeTier == 0)
            {
                spawnDelay  = 1.75f;
                spawnAmount = 5;
            }
            else if (bikeTier == 1)
            {
                spawnDelay  = 1.5f;
                spawnAmount = 8;
            }
            else if (bikeTier > 1)
            {
                spawnDelay  = 1.25f;
                spawnAmount = 10;
            }
        }

        if (SFX != null)
        {
            aSource = SFX.gameObject.GetComponent <AudioSource>();
        }

        foreach (Button button in buttons)
        {
            button.onClick.AddListener(() => ButtonClick());
        }

        if (finishPanel != null)
        {
            finishPanel.SetActive(false);

            messageText = finishPanel.transform.GetChild(0).GetComponent <Text>();
            rewardText  = finishPanel.transform.GetChild(1).GetComponent <Text>();
        }

        instructPanel.SetActive(true);
        Time.timeScale = 0;
        StartCoroutine(Spawn());
    }
예제 #36
0
    private SfxHandler sfxScript;     // markcode

	public override void Start () {
		base.Start();
		GameObject gc = GameObject.FindGameObjectWithTag ("GameController");
		ih = (InputHandler)gc.GetComponent(typeof(InputHandler));
		ih.UnFreeze ();
		gcs = (GameControllerScript)gc.GetComponent (typeof(GameControllerScript)); 
		tc = (TierController)this.gameObject.GetComponent (typeof(TierController));

        // markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller
        this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler));
    }
예제 #37
0
	// Use this for initialization

	void Start() 
	{
		map = GameObject.FindGameObjectWithTag("Map");
		gameController = GameObject.FindGameObjectWithTag ("GameController");
		gameControllerScript = gameController.GetComponent<GameControllerScript> ();
		Vector3 scale = map.transform.localScale;
		mapXSize = scale.x;
		mapYSize = scale.y;
		obstacles  = gameControllerScript.allObstacles;
		animation = GetComponent<Animator>();
	}
예제 #38
0
 public void Initialize(int x, int y, int z, string axis, GameControllerScript gameScript)
 {
     this.scale = gameScript.scale;
     this.yOffset = gameScript.yOffset;
     this.gameScript = gameScript;
     this.moveDuration = gameScript.moveDuration;
     this.x = x;
     this.y = y;
     this.z = z;
     this.axis = axis;
     this.ResetPosition();
 }
예제 #39
0
    void Start()
    {
        GameObject world = GameObject.Find("GameController");
        if (world != null)
        {
            this.gcs = GameObject.FindWithTag("GameControllerTag").GetComponent<GameControllerScript>();
        }

        if (timeToLive == 0.0f)
        {
            timeToLive = 2.0f;
        }
        this.lifetime = Time.time + this.timeToLive;
        this.gcs.AddShot(gameObject);
    }
예제 #40
0
	// Use this for initialization
	void Start () {
		SpriteRenderer[] s = this.gameObject.GetComponentsInChildren<SpriteRenderer>();
		s[1].enabled = false;
		GCScript = (GameControllerScript)FindObjectOfType(typeof(GameControllerScript));
		switch(gameObject.tag){
			case "One" : n = 1; break;
			case "Two" : n = 2; break;
			case "Three" : n = 3; break;
			case "Four" : n = 4; break;
			case "Five" : n = 5; break;
			case "Six" : n = 6; break;
			case "Seven" : n = 7; break;
			case "Eight" : n = 8; break;
			case "Nine" : n = 9; break;
		}
	}
 void Awake()
 {
     Instance = this;
     psScript = GameObject.Find("PlayerSettings").GetComponent<PlayerSettingsScript>();
     turret = GameObject.FindGameObjectWithTag("Turret");
     ovrCamera = GameObject.Find("OVRCameraController");
     if(psScript.oculusOn)
     {
         ovrCamera.SetActive(true);
         turret.SetActive(false);
     }
     else
     {
      	turret.SetActive(true);
         ovrCamera.SetActive(false);
     }
 }
예제 #42
0
	// Use this for initialization
	void Start () {
		GameController = gameObject.GetComponent<GameControllerScript>();
		InGameMenu.SetActive(false);
		FireMenu.SetActive(false);

		foreach(GameObject level in Levels) { // Disable All Levels
			level.SetActive(false);
		}
		if(currentLevel >= Levels.Length) { // Invalid currentLevel
			if(debugEnabled) {
				Debug.Log("Level Does Not Exist: "+currentLevel);
			}
			SceneManager.LoadScene("HomeScene");
			return;
		}

		Levels[currentLevel].SetActive(true);
	}
예제 #43
0
파일: UIScript.cs 프로젝트: Reppy-Why/TODO
    public void LateStart ()
    {
		PC = GameObject.FindGameObjectWithTag (Tags.player);
		PCStats = PC.GetComponent<PlayerStats> ();
	
		GameController = GameObject.FindGameObjectWithTag (Tags.gameController)
            .GetComponent<GameControllerScript> ();

        LabelPCName = GameObject.Find ("PC Info: Name")
            .GetComponent<UILabel> ();
        LabelPCLevelClass = GameObject.Find ("PC Info: Level and Class")
            .GetComponent<UILabel> ();
        LabelScoreValue = GameObject.Find ("Score: Info")
            .GetComponent<UILabel> ();

        BarHP = GameObject.Find ("1. Bar (HP)");
        BarMP = GameObject.Find ("2. Bar (MP)");
        BarHunger = GameObject.Find ("3. Bar (Hunger)");
        BarEXP = GameObject.Find ("4. Bar (EXP)");
    }
예제 #44
0
    void Start()
    {
        this.blowItUp = new DestroyAsteroidDelegate(AsteroidWasDestroyed);

        GameObject world = GameObject.Find("GameControllerTag");
        if (world != null)
        {
            this.gcs = world.GetComponent<GameControllerScript>();
        }

        if (this.numAsteroidsToSpawn == 0)
        {
            this.numAsteroidsToSpawn = 2;
        }

        if (this.maxVelocity == 0)
        {
            this.maxVelocity = 2.0f;
        }
    }
예제 #45
0
 void Start()
 {
     shootAnim = flare.GetComponent<Animator> ();
     audioS = GetComponent<AudioSource> ();
     gcs = GameObject.FindObjectOfType<GameControllerScript> ();
     //	KSx = new kalmanState (0.0625f, 32.0f, 0.0f, 1.3833094f, 0.043228418f);
     prevCrosshairPos = new List<Vector2> ();
     crosshairSize = crosshair.rectTransform.rect.width;
     //Debug.Log (crosshairSize);
     realScreenHeight = Screen.height;
     realScreenWidth = Screen.width;
     //Debug.Log (realScreenWidth + " " + realScreenHeight);
     hydrasOffset = transform.position;
     transform.Translate (HidraScreenCenterDiff);
     gHoles = new ArrayList ();
     fireDir = Vector3.zero;
     raySource = Vector3.zero;
     m_hands = GetComponentsInChildren<Hydra>();
     screenPlane = new Plane (Vector3.right, Vector3.up, new Vector3(1,1,0));
     if (useRifle) {
         foreach (Hydra hand in m_hands) {
             if (hand.m_hand == SixenseHands.RIGHT) {
                 GameObject GORifle = Instantiate (rifle, hand.transform.position, Quaternion.Euler (new Vector3 (0.0f, 180.0f, 0.0f))) as GameObject;
                 //GORifle.transform.parent = hand.gameObject.transform;
                 rifleInstance = GORifle;
             }
         }
     }
     crosshair.rectTransform.localPosition = new Vector3 (-realScreenWidth/2 + crosshairSize/2 , realScreenHeight/2 - crosshairSize/2);
     //w_parts = GetComponentsInChildren<WController>();
 }
예제 #46
0
 // Use this for initialization
 void Start()
 {
     this.gameScript = this.gameObject.GetComponent ("GameControllerScript") as GameControllerScript;
     this.currentGUISkin = gameScript.currentGUISkin;
     this.InitOptions();
 }
예제 #47
0
 void Awake()
 {
     gameController = gameObject.GetComponent<GameControllerScript>();
     this.theCamera = Camera.main;
     currentPlayer = gameController.CurrentPlayer();
 }
예제 #48
0
    public GameControllerScript GameController()
    {
        if(null == gameControllerScript)
            gameControllerScript = GameObject.Find("GameController").GetComponent<GameControllerScript>();

        return gameControllerScript;
    }
예제 #49
0
    // Use this for initialization
    void Start()
    {
        this.gameScript = this.gameObject.GetComponent ("GameControllerScript") as GameControllerScript;
        this.options = this.gameObject.GetComponent ("OptionsScript") as OptionsScript;
        this.currentGUISkin = gameScript.currentGUISkin;
        this.InitTimer ();

        AudioSource[] audioSources = GetComponents<AudioSource>();
        this.countdownAudioSource = audioSources[2];
        countdownAudioSource.clip = this.countdownSound;
    }
예제 #50
0
    void Start()
    {
        //transform.position = Vector3.zero; //default position at start
        turnSpeed = 0;
        pitchSpeed = 0;
        GCScript = GetComponent<GameControllerScript>();
        thrusterSource = transform.FindChild("Thrusters").GetComponent<AudioSource> ();
        musicSource = transform.Find("MusicSource").GetComponent<AudioSource> ();
        ambientSource = transform.Find("AmbientSource").GetComponent<AudioSource> ();

        shipSource = GetComponent<AudioSource> ();
    }
예제 #51
0
 void Awake()
 {
     this.resetting = false;
     // Set our activate cooldown
     this.activateTimer = 0;
     // Find our game controller
     this.gameController = FindObjectOfType<GameControllerScript>();
     int levelCompletionTime = FindObjectOfType<LevelStats>().levelCompletionTime;
     // Allocate enough space in the array for recorded input
     this.recordedInput = new CapturedInput[levelCompletionTime];
     this.groundCheck = GetComponent<GroundCheck>();
     this.playerColor = GetComponent<SpriteRenderer>().color;
     this.originalPosition = transform.position;
     this.currentInput = new CapturedInput();
     this.activatorsList = new Hashtable();
     this.overwriteLoop = false;
 }
예제 #52
0
 void Start()
 {
     bCollider = GetComponent<BoxCollider> ();
     GameObject gcObject = GameObject.FindGameObjectWithTag ("GameController");
     if (gcObject != null)
         gameController = gcObject.GetComponent<GameControllerScript> ();
 }
예제 #53
0
 // Use this for initialization
 void Start()
 {
     aGameController = GameObject.Find("GameControllerObject").GetComponent<GameControllerScript>();
 }
예제 #54
0
 // Use this for initialization
 void Start()
 {
     //find finds the object in the scene, and the getComponent accesses its script
     aGameController = GameObject.Find("GameControllerObject").GetComponent<GameControllerScript>();
 }