Пример #1
1
 //public string objectNarration;
 // Use this for initialization
 void Start()
 {
     playerCamera = GameObject.Find("First Person Controller/Main Camera");
     objectNarration = GameObject.Find("Object Narration");
     objectNarrationGUI = objectNarration.GetComponent<GUIText>();
     objectNarrationGUI.enabled = false;
 }
Пример #2
0
    /// <summary>
    /// Used for initialization
    /// </summary>
    void Awake()
    {
        mInstructions = GameObject.Find("TextInstructions").GetComponent<GUIText>();
        mInstructions.text += "\r\n";

        if (SceneName == "Demo")
        {
            mInstructions.text += "Move  - WASD or Left Stick" + "\r\n";
            mInstructions.text += "Walk  - WASD + Middle Mouse Button or Left Stick + Left Trigger" + "\r\n";
            mInstructions.text += "Turn  - Mouse + Right Mouse Button or Right Stick" + "\r\n";
        }
        else
        {
            mInstructions.text += "Move  - WAD or Left Stick" + "\r\n";
            mInstructions.text += "Target - WASD + Middle Mouse Button or Left Stick + Left Trigger" + "\r\n";
            mInstructions.text += "View  - Mouse + Right Mouse Button or Right Stick" + "\r\n";
        }
        
        mInstructions.text += "Jump  - Space or 'A' Button" + "\r\n";
        mInstructions.text += "Drop  - Shift or 'Y' Button" + "\r\n";
        mInstructions.text += "Sneak - T or Right Trigger" + "\r\n";
        mInstructions.text += "" + "\r\n";
        mInstructions.text += "Motions:" + "\r\n";
        mInstructions.text += "  Idle" + "\r\n";
        mInstructions.text += "  Forward" + "\r\n";
        mInstructions.text += "  Walk" + "\r\n";
        mInstructions.text += "  Sneak" + "\r\n";
        mInstructions.text += "  Slide" + "\r\n";
        mInstructions.text += "  Jump" + "\r\n";
        mInstructions.text += "  Fall" + "\r\n";
        mInstructions.text += "  Climb High" + "\r\n";
        mInstructions.text += "  Climb Mid" + "\r\n";

        mSwap = new Rect(10, 100 + ((mBtnHeight + 10) * 0), mBtnWidth, mBtnHeight);
    }
Пример #3
0
	// Use this for initialization
	void Start ()
	{	
		// The XML file containing the atlas UVs
		FastGUIElement.uvxmlFile = @"assets//resources//Frontend_AtlasUV.xml";
		
		// Persistent across tabs
		Store_Background = new FastGUIElement (
			new Vector2 (0, 0),
			FastGUIElement.UVsFrom (@"Store_Background.png"));		
		General_BackButton = new FastGUIElement (
			new Vector2 (0, 0),
			FastGUIElement.UVsFrom (@"General_BackButton.png"));
		General_CoinDisplay = new FastGUIElement (
			new Vector2 (1536, 0),
			FastGUIElement.UVsFrom (@"General_CoinDisplay.png"));
		
		// Create tabs
		wardrobe = new StoreWardrobe ();
		gear = new StoreGear ();
		bank = new StoreBank ();
		
		// Create the GUITexts
		//aGUIText = (GUIText)gameObject.AddComponent (typeof (GUIText));
		GameObject go = Instantiate (Resources.Load ("Frontend_GUIText")) as GameObject;  // Note need to clone prefab as can't access pixel correct property from script
		aGUIText = go.guiText;
		aGUIText.transform.position = new Vector3 (.775f, .995f, 0);
		aGUIText.transform.localScale = new Vector3 (.5f, .5f, 1);
		aGUIText.text = "Coins\nGDs\nXP Level";
		aGUIText.color = Color.red;
	}
Пример #4
0
 void Start()
 {
     m_PlayGame = GameObject.Find("PlayGame").guiText;
     m_ExitGame = GameObject.Find("ExitGame").guiText;
     m_Practice = GameObject.Find("Practice").guiText;
     m_Game = Game.Instance;
 }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey (KeyCode.Escape)) {
            Application.LoadLevel ("Menu");
        }

        textPoints = GameObject.Find ("Score").guiText;
        textPoints.text = "Points: " + points.ToString ();
        //GUI TEXT LIVES
        textLives = GameObject.Find ("Health").guiText;
        textLives.text = "Health: " + health.ToString ();
        if (dead == true) {
            health--;
            if (health > -1) {
                dead = false;
            } else {
                if (points > PlayerPrefs.GetInt ("highscore")) {
                    PlayerPrefs.SetInt ("highscore", points);

                }
                PlayerPrefs.SetInt ("currentscore", points);
                Application.LoadLevel ("GameOver");
            }
        }
    }
Пример #6
0
 private void InitializeTemperature()
 {
     TemperatureText = new GUIText();
     TemperatureText.font = (Font)UnityEngine.Resources.Load("Fonts/Arial Black", typeof(Font));
     TemperatureText.font.material.color = new Color(0f,255f,0f);
     //CurrentTemp = NormalBodyTemp;
 }
Пример #7
0
 // Initialization
 void Awake()
 {
     // Get reference from the gameObject
     label = GetComponent<GUIText>();
     // Unity trick to create dinamic fonts
     label.fontSize = (int)(Screen.height * dinamicFontSize * 0.0035f);
 }
	// Use this for initialization
	void Start () {
        if (last_level) {
            adjustMenuForLastLevel();
        }
        header_text = header_text_object.GetComponent<GUIText>();
        option_texts = new GUIText[option_text_objects.Length];
        for (int i = 0; i < option_text_objects.Length; ++i) {
            option_texts[i] = option_text_objects[i].GetComponent<GUIText>();
        }

        header_offset = 0.85f;
        option_list_offset_from_header = 0.13f;
        between_option_offset = 0.11f;
        header_text_size = 0.07f;
        option_text_size = 0.055f;
        header_text.pixelOffset = new Vector2(Screen.width * 0.5f, Screen.height * header_offset);
        header_text.fontSize = Mathf.RoundToInt(Screen.width * header_text_size);
        header_text.text = LEVEL_SCENE_NAME_MAP[current_level_scene_name] + "  Cleared";

        float cur_option_offset = header_offset - option_list_offset_from_header;
        for (int i = 0; i < option_text_objects.Length; ++i) {
            option_texts[i].pixelOffset = new Vector2(Screen.width * 0.5f, Screen.height * cur_option_offset);
            option_texts[i].fontSize = Mathf.RoundToInt(Screen.width * option_text_size);
            option_texts[i].color = unselected_color;
            cur_option_offset -= between_option_offset;
        }

        selected_option = 0;
        option_texts[0].color = selected_color;
        SelectorBox.box.setStartPosition(getSelectedLevelPosition());
        sound_waiting = false;
	}
Пример #9
0
	void Awake () {
		timer = timerObj.GetComponent<timer>();
		clearText = GameObject.Find("ClearText").GetComponent<GUIText>();
		isPlaying = true;
		isClear = false;
		isGameOver = false;
	}
Пример #10
0
    //----------------------------------- End Of Delcarations --------------------------------------------------------------------------------------------------
    public void AddPoints(int v)
    {
        score += v;
        guiscore = GameObject.Find("GuiScore").GetComponent<GUIText>();

        guiscore.text = "Score : " + score;
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        armor = 5;

        if (gameObject.name.IndexOf('(') != -1)
        {
            maxHP = PlayerPrefs.GetFloat(gameObject.name.Substring(0, gameObject.name.IndexOf('(')) + "_heart") * 100 <= 0 ? 100 : PlayerPrefs.GetFloat(gameObject.name.Substring(0, gameObject.name.IndexOf('(')) + "_heart") * 100;
            armor += PlayerPrefs.GetFloat(gameObject.name.Substring(0, gameObject.name.IndexOf('(')) + "_armor") * 5;
        }
        else if (gameObject.name == "gunman")
        {
            maxHP = 100;
        }

        currentHP = maxHP;

        text = gameObject.AddComponent<GUIText>();

        timespan = 0f;
        checktime = 2.0f;

        //HP = Instantiate(HP, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z), gameObject.transform.rotation) as Canvas;

        animation = GetComponent<Animator>();

        hpBar = GetComponentsInChildren<Image>();
    }
Пример #12
0
		// Use this for initialization
		void Start ()
		{
				GUI_gameover = GameObject.Find ("GUI gameover").GetComponent<GUIText> ();
				
				GameObject.Find ("GUI score").GetComponent<GUIText> ().text = "Score: 0";
				SpawnBall ();
		}
Пример #13
0
 // Use this for initialization
 void Start()
 {
     guiText = gameObject.GetComponent<GUIText>();
     textBackground = GameObject.Find("ScoreBackground").GetComponent<GUITexture>();
     mic = GameObject.Find ("Beat Detector").GetComponent<MicrophoneInput>();
     player = GameObject.Find ("Player").GetComponent<Movement>();
 }
Пример #14
0
 void Start()
 {
     GameObject st = GameObject.Find ("state");
     state=st.GetComponent("GUIText") as GUIText;
     communicator=GameObject.Find("Communicator");
     comm = communicator.GetComponent ("CommunicationCotroler") as CommunicationCotroler;
 }
Пример #15
0
	void Start() {
		// Find the GUI components
		GameObject go = GameObject.Find("ShotCounter");
		shotCounter = go.GetComponent<GUIText>();
		go = GameObject.Find("ShotRating");
		shotRating = go.GetComponent<GUIText>();
		go = GameObject.Find("_Check_64");
		checkMark = go.GetComponent<GUITexture>();
		go = GameObject.Find ("WhiteOut");
		whiteOut = go.GetComponent<GUITexture>();
		// Hide the checkMark and whiteOut
		checkMark.enabled = false;
		whiteOut.enabled = false;

		// Load all the shots from PlayerPrefs
		Shot.LoadShots();
		// If there were shots stored in PlayerPrefs
		if (Shot.shots.Count>0) {
			shotNum = 0;
			ResetPlayerShotsAndRatings();
			ShowShot(Shot.shots[shotNum]);
		}

		// Hide the cursor (Note: this doesn't work in the Unity Editor unless
		// the Game pane is set to Maximize on Play.)
		Screen.showCursor = false;

		camRectNormal = camera.rect;
	}
Пример #16
0
    // Use this for initialization
    void Start()
    {
		startingX = (int) transform.position.x;
		scoreText = GameObject.Find("Score").guiText;
		lifeText = GameObject.Find("Life").guiText;
		obstacleSpawner = GameObject.Find("ChunkManager").GetComponent<ObstacleSpawner>();
    }
Пример #17
0
	void Awake()
	{
		text = GetComponent<GUIText>();

		if (mode == Mode.WhileTrue || mode == Mode.WhileFalse)
			timer = fade * text.color.a;
	}
Пример #18
0
    void Start()
    {
        introText = "";
        showIntroText = true;
        intro = new ArrayList();

        FileInfo theSourceFile = new FileInfo("Assets/StoryAssets/Level1.txt");
        StreamReader reader = theSourceFile.OpenText();
        SpeechBubbleText = GameObject.FindWithTag("SpeechBubbleText").GetComponent<GUIText>() as GUIText;
        string line;
        int i = 0;
        currentLine = 0;

        do
        {
            line = reader.ReadLine();
            intro.Add(line);
            i++;
        } while (line != null);

        do
        {
            if (currentLine >= 5)
            {
                showIntroText = false;
            }

            SpeechBubbleText.text = (intro[currentLine]).ToString();
            StartCoroutine(HideSpeechBubble());
        } while (showIntroText == true);
    }
    // Use this for initialization
    void Start() {
        start_text = this.gameObject.GetComponent<GUIText>();

        gui_color = Color.white;
        fade_start_text = false;
        fadeInLogo();
    }
Пример #20
0
	// Use this for initialization
	void Start () {
		instance = this;

		player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();

		GameObject mapCameraObj = GameObject.FindGameObjectWithTag ("mapCamera");
		if(mapCameraObj != null){
			mapCamera = mapCameraObj.GetComponent<Camera>();
			mapCamera.enabled = false;
		}

		GUITexture[] hudGUIs = GetComponentsInChildren<GUITexture>();
		powerImg = hudGUIs[0];
		crosshairImg = hudGUIs[1];
		matchImg = hudGUIs[2];
		if (mapCamera != null) {
			gunCrosshairImg = hudGUIs [3];
		}

		GUIText[] guiText = GetComponentsInChildren<GUIText>();
		hintsText = guiText[0];

		if (mapCamera != null) {
			hpText = guiText [1];
			bulletText = guiText [2];
			hiScoreText = guiText [3];
			scoreText = guiText [4];
		}

		HideCursor();
		SetHiScore(hiScore);
	}
Пример #21
0
    void Awake()
    {
        #if !(UNITY_EDITOR)

        _gui_text = GetComponent<GUIText> ();
        _gui_texture = GetComponent<GUITexture> ();
        screenX = Screen.width;
        screenY = Screen.height;
        scaleX = screenX / 960;
        scaleY = screenY / 640;

        if (_gui_texture != null) {
            _guiWidth = _gui_texture.pixelInset.width;
            _guiHeight = _gui_texture.pixelInset.height;

            _guiWidth *= scaleX;
            _guiHeight *= scaleY;
        }

        if(_gui_text != null)
        {
            _gui_text.fontSize = (int)(edit_fontSize * (scaleX));
        }

        PositionSetting ();
        #endif
    }
Пример #22
0
    //-------------------------------------------------------------
    void Awake()
    {
        CollisionRect = this.guiTexture.GetScreenRect(Camera.main);
        Label = this.GetComponentInChildren<GUIText>();

        UpdateTexture();
    }
Пример #23
0
 // Use this for initialization
 void Start()
 {
     hScore = PlayerPrefs.GetFloat ("highscore");
     gText = score.GetComponent<GUIText> ();
     hgText = hscore.GetComponent<GUIText> ();
     InvokeRepeating("CreateAsteroid", 1f, .3f); //Manipulate last two parameters depending on desired spawn rate
 }
Пример #24
0
	// Use this for initialization
	void Start () {
		textObject = GetComponent<GUIText>();

		// scale the wrap width to the proper size for the screen
		wrapAtWidth = (wrapAtWidth * Screen.width) / targetResolutionWidth;

	}
 // Use this for initialization
 void Start()
 {
     lastContacts = new List<Contact>();
     _guiText = GetComponent<GUIText>();
     //Debug.Log(string.Format("lots of razors {0} should be here", "1337"));
     //Time.timeScale = 0.5f;
 }
Пример #26
0
 // Use this for initialization
 void Start()
 {
     audio = GameObject.FindWithTag("Audio");
     a = audio.GetComponents<AudioSource>();
     m = GameObject.FindWithTag("Contador");
     marcador = m.GetComponent<GUIText>();
 }
Пример #27
0
	// Use this for initialization
	void Start () {
		sectionDivSeaFlat = (GameObject)GameObject.Instantiate(sectionDivider);
		sectionDivSeaFlat.transform.position = new Vector3(seaFlatStartPosX, 0, zDistance);

		sectionDivDeepEnd = (GameObject)GameObject.Instantiate (sectionDivider);
		sectionDivDeepEnd.transform.position = new Vector3(deepEndStartPosX, 0, zDistance);
		sectionDivDeepEnd.GetComponent<SectionChange>().leftZone = 1;
		sectionDivDeepEnd.GetComponent<SectionChange>().rightZone = 2;
		sectionDivDeepEnd.GetComponent<SectionChange>().leftName = "Sea Flat";
		sectionDivDeepEnd.GetComponent<SectionChange>().rightName = "Deep End";


		spawnHandler = (GameObject)GameObject.Instantiate(spawnHandler);

		theBoat = (GameObject)GameObject.Instantiate(boat);
		theBoat.transform.position = new Vector3(boat.transform.position.x, boat.transform.position.y, zDistance);

		water = (GameObject)GameObject.Instantiate(water);

		theBoat.GetComponent<BoatController>().water = water.GetComponent<WaterHandler>();

		scoreTextObject = (GameObject)GameObject.Instantiate(scoreTextObject);
		scoreText = scoreTextObject.GetComponent<GUIText>();

		cameraMain = GameObject.Find("MainCamera");
		cameraMain.GetComponent<CameraController>().target = theBoat;
	}
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator>();
     playerScript = GetComponent<PlayerControl>();
     leftAmmo = ammo;
     ammoText = GameObject.FindWithTag("AmmoText").GetComponent<GUIText>();
 }
Пример #29
0
 // Use this for initialization
 void Start()
 {
     a = GameObject.Find("battleBackground").GetComponent<BattleButtonManage>();
     guiTt = gameObject.GetComponent<GUIText>();
     block = new Rect(gameObject.transform.position.x * Screen.width , (1 - gameObject.transform.position.y) * Screen.height + 24, Screen.width / 8, Screen.height / 16);
     _lifeBar = new Rect(gameObject.transform.position.x * Screen.width, (1 - gameObject.transform.position.y) * Screen.height, Screen.width / 8, Screen.height / 18);
 }
Пример #30
0
    void Start()
    {
        guiTextClock = GetComponentInChildren<GUIText> ();

        particles = GetComponentInChildren<ParticleSystem> ();
        particles.enableEmission = false;
    }
Пример #31
0
 // Use this for initialization
 void Start()
 {
     //查找ui界面 Ui空物体管理ui组件
     start_ui = GameObject.Find("GAMEST");
     game_ui  = GameObject.Find("GAME");
     end_ui   = GameObject.Find("GAMEEND");
     //查找脚本
     m_weapon       = GameObject.Find("weapon").GetComponent <weapon>();
     m_feipanmanger = GameObject.Find("feipanmanger").GetComponent <feipanmanger>();
     //查找音乐引用
     music = GameObject.Find("Main Camera").GetComponent <AudioSource>();
     //查找时间UI组件
     m_time       = GameObject.Find("gametime").GetComponent <GUIText>();
     m_totalscore = GameObject.Find("TOTALSCPRE").GetComponent <GUIText>();
     m_score      = GameObject.Find("fenshu").GetComponent <GUIText>();
     //初始为开始界面
     statechangge(gamestate.start);
 }
Пример #32
0
    private void attachObjectLabel(GameObject target, string text, Color?color = null)
    {
        if (color == null)
        {
            color = defaultLabelColor;
        }
        GameObject go = new GameObject("Axis Label");
        GUIText    gt = (GUIText)go.AddComponent(typeof(GUIText));

        //TextMesh gt = (TextMesh)go.AddComponent(typeof(TextMesh));
        gt.font           = axisLabelFont;
        gt.text           = text;
        gt.alignment      = TextAlignment.Center;
        gt.material.color = (Color)color;

        ((ObjectLabel)go.AddComponent("ObjectLabel")).target = target.transform;
        go.transform.parent = this.transform;
    }
Пример #33
0
        private void ClearScreen()
        {
            // 对象还没创建全的情况下不清
            if (guiList.Count < maxLines)
            {
                return;
            }

            int count = 0;

            while (count < guiList.Count)
            {
                GUIText gt = guiList[count];
                gt.text = string.Empty;

                ++count;
            }
        }
Пример #34
0
 void OnGUI()
 {
     GUIText.LayoutHead("LIVE2D TOOLS", 20);
     GUIText.LayoutSplit(">>选择要打包的模型根文件夹", 15);
     modelPath = GUIFolderSelect.OnGUI("", 0, modelPath ?? DefaultModelDir, onSelect: (arg) =>
     {
         arg = FileSystem.StandardizeSlashSeparator(arg);
         Debug.Log($"已选择模型文件夹:{arg}");
         return(arg);
     });
     GUILayout.BeginVertical();
     GUILayout.Space(10);
     if (GUILayout.Button("导出"))
     {
         Export();
     }
     GUILayout.EndVertical();
 }
Пример #35
0
        ///<summary>
        ///	Use this for initialization
        ///</summary>
        override protected void Start()
        {
            base.Start();

            _paddleRightGUIText  = paddleRightGUIText_gameobject.GetComponent <GUIText>();
            _paddleRightGUIText2 = paddleRightGUIText2_gameobject.GetComponent <GUIText>();
            _paddleLeftGUIText   = paddleLeftGUIText_gameobject.GetComponent <GUIText>();
            _paddleLeftGUIText2  = paddleLeftGUIText2_gameobject.GetComponent <GUIText>();
            _promptGUIText       = promptGUIText_gameObject.GetComponent <GUIText>();
            _promptGUIText2      = promptGUIText2_gameObject.GetComponent <GUIText>();
            _restartGUIText      = restartGUIText_gameObject.GetComponent <GUIText>();
            _restartGUIText2     = restartGUIText2_gameObject.GetComponent <GUIText>();
            //
            _fpsGUIText = fpsGUIText_gameObject.GetComponent <GUIText>();

            //CLEAR PROMPT BEFORE ITS FIRST USE
            _setPromptText("");
        }
Пример #36
0
    // =============================================================================



    // =============================================================================
    // METHODS UNITY ---------------------------------------------------------------

    void Start()
    {
        Trans = transform;

        GuiText = guiText;
        GuiText.font.material.color = TextColor;
        //GuiTextAlphaOriginal = GuiText.font.material.color.a;
        //FontBaseSize = GuiText.fontSize;

        if (Background)
        {
            BackgroundTransform     = Background.transform;
            BackgroundAlphaOriginal = Background.color.a;

            BackgroundTransform.localScale = Vector3.zero; // should be done, dont know why
            Background.pixelInset          = new Rect(0, 0, 0, 0);
        }
    }
Пример #37
0
    //程序入口
    void Awake()
    {
        state     = State.Loaded;
        scoreText = scoreObject.GetComponent <GUIText>();
        Vector3 resetButtonWorldPosition = Camera.main.WorldToScreenPoint(new Vector3(3, 0, -10));

        resetButton = new Rect(resetButtonWorldPosition.x,
                               resetButtonWorldPosition.y,
                               resetButtonWidth,
                               resetButtonHeight);

        Vector3 gameOverButtonWorldPosition = Camera.main.WorldToScreenPoint(new Vector3(3, 0, -10));

        gameOverButton = new Rect(gameOverButtonWorldPosition.x,
                                  gameOverButtonWorldPosition.y,
                                  gameOverButtonWidth,
                                  gameOverButtonHeight);
    }
Пример #38
0
    string displayString = "";    //提示信息内容
    //int stringCount = 0;  //提示信息行数
    // Rect helpRect;
    // int helpStrCount = 0;  //帮助信息行数

    // Rect exerciseRect;  //练习时出现的提示窗口

    // Rect componentsRect;  //部件提示窗口

    // Use this for initialization
    void Awake()
    {
        tipsRect = new Rect(100f, 100f, 263f, 60f);
        try{
            tipsText = GameObject.Find("TipsText").guiText;
        }catch {
            Debug.LogError("请手动添加一个GUI Text,并且命名为“TipsText”," +
                           "同时将GUIText属性勾选为False,用于计算Tips显示长度。");
            return;
        }
        tipsText.font     = (Font)Resources.Load("Font/msyh");
        tipsText.fontSize = 15;
        // helpRect = new Rect(100f, 100f, 249f, 60f);
        // exerciseRect = new Rect(0, 0, 305, 225);
        // exerciseRect.x = (Screen.width - exerciseRect.width) / 2f;
        // exerciseRect.y = (Screen.height - exerciseRect.height) / 2f;
        // componentsRect = new Rect(100f, 100f, 160f, 60f);
    }
Пример #39
0
 void Update()
 {
     CekTimer();
     if (Input.GetMouseButtonDown(0))
     {
         hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
         if (hit.collider.gameObject.tag == "Bubble")
         {
             SelectedObject       = hit.transform;
             selectedRigid        = hit.rigidbody;
             isTouching           = true;
             bubbleScript         = SelectedObject.gameObject.GetComponent <BubbleScript>();
             bubbleScript.clicked = true;
             textInBubble         = SelectedObject.GetComponentInChildren <GUIText>();
         }
         else
         {
             SelectedObject = null;
             selectedRigid  = null;
             bubbleScript   = null;
             isTouching     = false;
         }
     }
     else if (Input.GetMouseButtonUp(0))
     {
         if (bubbleScript.TriggeringA)
         {
             a += int.Parse(textInBubble.text);
             SelectedObject.gameObject.SetActive(false);
             CekSoal();
         }
         else if (bubbleScript.TriggeringB)
         {
             b += int.Parse(textInBubble.text);
             SelectedObject.gameObject.SetActive(false);
             CekSoal();
         }
         SelectedObject       = null;
         selectedRigid        = null;
         isTouching           = false;
         bubbleScript.clicked = false;
         bubbleScript         = null;
     }
 }
Пример #40
0
    // Update is called once per frame
    void Update()
    {
        ++frames;

        var timeNow = Time.realtimeSinceStartup;

        if (timeNow > lastInterval + updateInterval)
        {
            if (!gui)
            {
                GameObject go = new GameObject("FPS Display", typeof(GUIText));
                go.hideFlags          = HideFlags.HideAndDontSave;
                go.transform.position = new Vector3(0, 0, 0);
                gui             = go.GetComponent <GUIText>();
                gui.color       = tx_Color;
                gui.pixelOffset = new Vector2(15, Screen.height - 15);
            }

            float fps = frames / (timeNow - lastInterval);
            float ms  = 1000.0f / Mathf.Max(fps, 0.00001f);

            ++framesavtick;
            framesav += fps;
            float fpsav = framesav / framesavtick;

            tx.Length = 0;

            tx.AppendFormat("Time : {0} ms     Current FPS: {1}     AvgFPS: {2}\nGPU memory : {3}    Sys Memory : {4}\n", ms, fps, fpsav, SystemInfo.graphicsMemorySize, SystemInfo.systemMemorySize)

            .AppendFormat("TotalAllocatedMemory : {0}mb\nTotalReservedMemory : {1}mb\nTotalUnusedReservedMemory : {2}mb",
                          Profiler.GetTotalAllocatedMemory() / 1048576,
                          Profiler.GetTotalReservedMemory() / 1048576,
                          Profiler.GetTotalUnusedReservedMemory() / 1048576
                          );

#if UNITY_EDITOR
            tx.AppendFormat("\nDrawCalls : {0}\nUsed Texture Memory : {1}\nrenderedTextureCount : {2}", UnityStats.drawCalls, UnityStats.usedTextureMemorySize / 1048576, UnityStats.usedTextureCount);
#endif

            gui.text     = tx.ToString();
            frames       = 0;
            lastInterval = timeNow;
        }
    }
Пример #41
0
    private void Start()
    {
        _agentScripts = transform.GetComponentsInChildren <AnimationInfo>();


        _dropDownRectAgents    = new DropDownRect(new Rect(115, 20, 90, 300));
        _dropDownRectAnimNames = new DropDownRect(new Rect(210, 20, 90, 300));

        for (int i = 0; i < 32; i++)
        {
            _driveParams[i] = new DriveParams();
        }



        for (int i = 0; i < 32; i++)
        {
            _driveParams[i].ReadValuesDrives(i);
        }


        _firstRun = true;



        _agentSelInd = 0;



        _persMapper = new PersonalityMapper();



        foreach (AnimationInfo t in _agentScripts)
        {
            Reset(t);
        }

        AgentText = new GUIText[_agentScripts.Length];

        //   FormatData("motionEffortCoefs.txt");

        MathDefs.SetSeed(30);
    }
Пример #42
0
    // Update is called once per frame
    void Update()
    {
        // Get the GUIText component
        GUIText gt = this.GetComponent <GUIText> ();

        // Check the GameObject's tag
        if (go.tag == "Wins")
        {
            // If the tag is "Wins" then update its text to the current number of wins
            gt.text = wins.ToString();
        }
        if (go.tag == "Loses")
        {
            // If the tag is "Loses" then update its text to the current number of losses
            gt.text = loses.ToString();
        }
        if (go.tag == "Total")
        {
            // If the tag is "Total" then update its text to the current number of total games played
            gt.text = total.ToString();
        }

        // Checks if the total number of games played is greater than or equal to 10 AND makes sure that button is not null
        if (total >= 10 && button != null)
        {
            // Changes the result text depending on the player's wins and losses
            if (wins == loses)
            {
                resultText.text = "Tied!";
            }
            else if (wins > loses)
            {
                resultText.text = "You Win!";
            }
            else
            {
                resultText.text = "You Lose...";
            }

            // Delays the play again menu
            StartCoroutine(DelayPlayAgainMenu());
            DelayPlayAgainMenu();
        }
    }
Пример #43
0
    void Start()
    {
        uint rc = NiteWrapper.Init(new StringBuilder(".\\OpenNI.xml"));

        if (rc != 0)
        {
            Debug.Log(String.Format("Error initing OpenNI: {0}", Marshal.PtrToStringAnsi(NiteWrapper.GetStatusString(rc))));
        }

        // Init depth & label map related stuff
        usersMapSize      = NiteWrapper.GetDepthWidth() * NiteWrapper.GetDepthHeight();
        usersLblTex       = new Texture2D(NiteWrapper.GetDepthWidth(), NiteWrapper.GetDepthHeight());
        usersMapColors    = new Color[usersMapSize];
        usersMapRect      = new Rect(Screen.width - usersLblTex.width / 2, Screen.height - usersLblTex.height / 2, usersLblTex.width / 2, usersLblTex.height / 2);
        usersLabelMap     = new short[usersMapSize];
        usersDepthMap     = new short[usersMapSize];
        usersHistogramMap = new float[5000];

        // text
        caption = GameObject.Find("GUI Text").guiText;

        // init our avatar controllers
        soldiers    = new SoldierAvatar[2];
        soldiers[0] = new SoldierAvatar(GameObject.Find("Soldier1"));
        //soldiers[1] = new SoldierAvatar(GameObject.Find("Soldier2")); // This line was removed so we can have 1 soldier without errors

        // init user lists - one will contain all users, the second will contain only calibrated & mapped users
        allUsers        = new List <uint>();
        calibratedUsers = new Dictionary <uint, SoldierAvatar>();

        // init user callbacks
        NewUser            = new NiteWrapper.UserDelegate(OnNewUser);
        CalibrationStarted = new NiteWrapper.UserDelegate(OnCalibrationStarted);
        CalibrationFailed  = new NiteWrapper.UserDelegate(OnCalibrationFailed);
        CalibrationSuccess = new NiteWrapper.UserDelegate(OnCalibrationSuccess);
        UserLost           = new NiteWrapper.UserDelegate(OnUserLost);

        // Start looking
        NiteWrapper.StartLookingForUsers(NewUser, CalibrationStarted, CalibrationFailed, CalibrationSuccess, UserLost);
        Debug.Log("Waiting for users to calibrate");

        // set default smoothing
        NiteWrapper.SetSkeletonSmoothing(0.6);
    }
Пример #44
0
    // Update is called once per frame
    void Update()
    {
        GUIText gt = this.GetComponent <GUIText>();

        if (Screen.width >= 1024)
        {
            gt.fontSize = 20;
        }
        if (Screen.width >= 500 && Screen.width < 1024)
        {
            gt.fontSize = 15;
        }

        if (Screen.width >= 100 && Screen.width < 500)
        {
            gt.fontSize = 10;
        }
        gt.text = "Ultimo Tiempo: " + score + "";
    }
Пример #45
0
    void Start()
    {
        guiCount = 0;

        if (guiCount == 0)
        {
            guiText = Instantiate(Resources.Load("Prefab/GUI/Helper/GuiText_FPSHelp", typeof(GUIText)), guiTextPos, Quaternion.identity) as GUIText;

            guiCount++;
        }

        if (!guiText)
        {
            Debug.Log("UtilityFramesPerSecond needs a GUIText component!");
            enabled = false;
            return;
        }
        timeleft = updateInterval;
    }
Пример #46
0
    private void GetReferencias()
    {
        // mostrar el dialogo mediano
        m_caja = transform.FindChild("caja");

        // obtener referencias a los elementos de la interfaz
        m_btnAceptar            = m_caja.FindChild("btnAceptar").GetComponent <btnButton>();
        m_btnCancelar           = m_caja.FindChild("btnCancelar").GetComponent <btnButton>();
        m_txtTitulo             = m_caja.FindChild("titulo").GetComponent <GUIText>();
        m_txtTituloSombra       = m_txtTitulo.transform.FindChild("sombra").GetComponent <GUIText>();
        m_txtTexto              = m_caja.FindChild("texto").GetComponent <GUIText>();
        m_imgAvatar             = m_caja.FindChild("imgAvatar").GetComponent <GUITexture>();
        m_imgEscudo             = m_caja.FindChild("imgAvatarEscudo").GetComponent <GUITexture>();
        m_txtEscudoBoost        = m_imgEscudo.transform.FindChild("texto").GetComponent <GUIText>();
        m_imgCash               = m_caja.FindChild("imgCash").GetComponent <GUITexture>();
        m_txtCantidadCash       = m_imgCash.transform.FindChild("texto").GetComponent <GUIText>();
        m_txtCantidadCashSombra = m_imgCash.transform.FindChild("textoSombra").GetComponent <GUIText>();
        m_velo = transform.FindChild("velo").GetComponent <btnButton>();
    }
Пример #47
0
    void Start()
    {
        m_winner = 0;

        // Read the state and assembly the board
        BuildBoardFromState(boardState);

        // Check we if are not seeing a done match
        m_winner = CheckForWinner();

        // Setup HUD with player pics and names
        GUITexture playerXPic  = GameObject.Find("PlayerXPic").GetComponent <GUITexture>();
        GUITexture playerOPic  = GameObject.Find("PlayerOPic").GetComponent <GUITexture>();
        GUIText    playerXName = GameObject.Find("PlayerXName").GetComponent <GUIText>();
        GUIText    playerOName = GameObject.Find("PlayerOName").GetComponent <GUIText>();

        StartCoroutine(SetProfilePic(playerInfoX.picUrl, playerXPic));
        StartCoroutine(SetProfilePic(playerInfoO.picUrl, playerOPic));

        playerXName.text    = playerInfoX.name;
        playerOName.text    = playerInfoO.name;
        playerTurnText.text = "Your Turn";

        m_turnPlayed = false;

        m_winner = CheckForWinner();
        if (m_winner != 0)
        {
            m_isHistoryMatch = true;
            m_turnPlayed     = true;
            if (m_winner == -1)
            {
                playerTurnText.text = "Match Tied";
            }
            else
            {
                playerTurnText.text = "Match Completed";
            }

            // Read match history
            BrainCloudWrapper.GetBC().AsyncMatchService.ReadMatchHistory(ownerId, matchId, OnReadMatchHistory, null, null);
        }
    }
Пример #48
0
    private void GetBaseHandles()
    {
        g_background = transform.FindChild("Background").GetComponent <GUITexture>();
        g_picture    = transform.FindChild("Picture").GetComponent <GUITexture>();

        g_name   = transform.FindChild("Name").GetComponent <GUIText>();
        g_energy = transform.FindChild("Energy").GetComponent <GUIText>();

        g_atack = transform.FindChild("atack").GetComponent <GUIText>();
        g_def   = transform.FindChild("def").GetComponent <GUIText>();
        g_hp    = transform.FindChild("hp").GetComponent <GUIText>();


        g_iconAtack = transform.FindChild("atack").GetComponent <GUITexture>();
        g_iconDef   = transform.FindChild("def").GetComponent <GUITexture>();
        g_iconHp    = transform.FindChild("hp").GetComponent <GUITexture>();

        g_nameBackground = transform.FindChild("Name").GetComponent <GUITexture>();
    }
Пример #49
0
    public Racer SpawnLobbyBall(ServerPlayer sp, bool isLocal)
    {
        Character c = Global.characters[sp.character]; //Get character for player
        Object    o;

        if (sp.player == Network.player)
        {
            o = ballPlayerLobbyPrefab;
        }
        else
        {
            o = ballRemoteLobbyPrefab;
        }
        Racer r = (Racer)Instantiate(o, new Vector3(0, 8, -4), Quaternion.Euler(0, 90, 25));

        r.name = o.name + "-" + sp.name;
        //Set character traits
        r.racerName         = sp.name;
        r.renderer.material = c.material;
        r.mapIconMaterial   = c.minimapIcon;
        r.GetComponent <TrailRenderer>().material = c.trail;
        BallControl bc = r.GetComponent <BallControl>();

        if (c.alternativeMesh != null)
        {
            r.GetComponent <MeshFilter>().mesh = c.alternativeMesh;
        }
        if (bc != null)
        {
            bc.stats = c.stats;
        }
        r.transform.localScale = new Vector3(c.ballSize, c.ballSize, c.ballSize);
        if (o == ballRemoteLobbyPrefab)
        {
            GUIText label = r.transform.FindChild("ObjectLabel").guiText;
            label.text  = sp.name;
            label.color = PlayerTypeHandler.GetPlayerColor(sp.type);
        }
        return(r);
        //Do more stuff
        //r.RaceController = raceController;
        //r.totalLaps = (int)settings.laps;
    }
Пример #50
0
    void Start()
    {
        ChooseAnimalForPlayer();

        totalScore                  = 0;
        scoreGUI                    = gameObject.AddComponent <GUIText> ();
        scoreGUI.fontSize           = 24;
        scoreGUI.fontStyle          = FontStyle.Bold;
        scoreGUI.transform.position = new Vector2(0f, 1f);
        scoreGUI.text               = totalScore.ToString() + "\n" + stageScore.ToString() + "/10";

        SpriteRenderer background = GameObject.Find("Background").GetComponent <SpriteRenderer>();

        backgroundMax = background.bounds.max;
        backgroundMin = background.bounds.min;
        PlayNextSong();

        Invoke("ChooseLocationToSpawn", minSpawnTime);
    }
Пример #51
0
    //public TestGame tg;

    // Use this for initialization
    void Start()
    {
        //SnakeGame.Instance.Initialize ();
        print("hello world");
        Debug.Log("hello log");

        go = new GameObject();
        go.transform.position   = new Vector3(0.5f, 0.5f, 0);
        go.transform.rotation   = Quaternion.identity;
        go.transform.localScale = new Vector3(0.1f, 0.1f, 1.0f);

        // 创建Texture
        Texture2D tex = new Texture2D(1, 1);

        tex.SetPixel(0, 0, Color.white);
        tex.Apply();

        // 创建GUITexture
        GUITexture guiTexture = go.AddComponent <GUITexture>();

        guiTexture.texture = tex;

        GUIText text = go.AddComponent <GUIText> ();

        text.text = "fine this is it!";

        //
        //go = new GameObject ();

        if (SnakeTexture == null)
        {
            SnakeTexture = new Texture2D(1, 1);
            SnakeTexture.SetPixel(0, 0, Color.green);
            SnakeTexture.Apply();
        }

        for (int i = 0; i < 10; i++)
        {
            SnakeBody body = go.AddComponent <SnakeBody>();
            body.Initialize();
            body.transform.position.Set(0.1f * i, 0.1f * i, 0);
        }
    }
Пример #52
0
    void Awake()
    {
                #if !(UNITY_EDITOR)
        _gui_text    = GetComponent <GUIText> ();
        _gui_texture = GetComponent <GUITexture> ();
        screenX      = Screen.width;
        screenY      = Screen.height;



        if (_gui_texture != null)
        {
            _guiWidth  = _gui_texture.pixelInset.width;
            _guiHeight = _gui_texture.pixelInset.height;
        }

        PositionSetting();
                #endif
    }
Пример #53
0
        IEnumerator Fade(GUIText text)
        {
            float counter = 0;

            yield return(new WaitForSeconds(LifeTime));

            while (counter < FadeOutTime && text != null)
            {
                counter += Time.deltaTime;
                text.SetColor((1 - (counter / FadeOutTime)) * Alpha, "A");
                yield return(null);
            }

            if (text != null)
            {
                text.SetColor(0, "A");
                RemoveLine(text);
            }
        }
Пример #54
0
    void Start()
    {
        if (transform.parent.GetComponent <GUITextShadow>() != null)
        {
#if UNITY_EDITOR
            DestroyImmediate(this);
#else
            Destroy(this);
#endif
            return;
        }

        GameObject shadow = (GameObject)Instantiate(gameObject);
        shadow.transform.parent        = transform;
        shadow.transform.localPosition = new Vector3(shadowOffset.x, shadowOffset.y, transform.localPosition.z - 1);

        shadowGuIText      = shadow.GetComponent <GUIText>();
        shadowGuIText.font = shadowFont;
    }
Пример #55
0
    void Start()
    {
        if (levelLabel == null)
        {
            levelLabel = GameObject.Find("LevelValue").GetComponent <GUIText>();
        }

        if (percentLabel == null)
        {
            percentLabel = GameObject.Find("PercentValue").GetComponent <GUIText>();
        }

        floatSize = levelLabel.fontSize;

        //hidePos = new Vector2(5f, 5f);

        level   = 0;
        percent = 0;
    }
Пример #56
0
    // Use this for initialization
    void Start()
    {
        music = GetComponentInChildren <AudioSource> ();

        // init text here, more space to work than in the Inspector (but you could do that instead)
        GUIText tc    = GetComponent <GUIText>();
        string  creds = "COLLISION\n\n\n";

        creds += "LEAD PRODUCER\nZsade Fleming\n\n\n";
        creds += "ARTWORK & STORY\nZsade Fleming\n\n\n";
        creds += "LEVEL DESIGN\nLogan Adams\n\n\n";

        creds += "PROGRAMMING\n\n";
        creds += "COMBAT DESIGN\nYohan Kim\n\n";
        creds += "ENEMY AI\nTyler Larkin\n\n";
        creds += "DIALOGUE\nBrendan Plante\n\n";
        creds += "UI & MISCELLANEOUS\nLogan Adams\nRyan Wnuk-Fink\n\n";
        creds += "\n\n\n";

        creds += "MUSIC & SOUND\n\n";
        creds += "Opening Menu\n\"Word play\" by Wendy Mao\n\n";
        creds += "Intro\n\"Rend\" by Ziyed Hedfi\n\n";
        creds += "Comic 1\n\"Rend\" by Ziyed Hedfi\n\n";
        creds += "Level 1\n\"Air\" by Ziyed Hedfi\n\n";
        creds += "Comic 2\n\"Rend\" by Ziyed Hedfi\n\n";
        creds += "Level 2\n\"Walking\" by Ziyed Hedfi\n\n";
        creds += "Comic 3\n\"Rend\" by Ziyed Hedfi\n\n";
        creds += "Level 3\n\"Nacho Cheese\" by Ziyed Hedfi\n\n";
        creds += "End Credits\n\"Word Play\" by Wendy Mao\n\n";

        creds += "\"Electricity\"\nRecorded by Mike Koenig\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Fizzle\"\nRecorded by Mike Koenig\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Metal Debris Falling\"\nRecorded by Mike Koenig\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Robot Arm Moving\"\nRecorded by Mike Koenig\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Laser Cannon\"\nRecorded by Mike Koenig\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Lever\"\nRecorded by Marianne Gagnon\nUsed under the Creative Commons Attribution 3.0 License\n\n";
        creds += "\"Dying Robot\"\nPublic Domain\n\n";
        creds += "\"Metal Rattling\"\nPublic Domain\n\n";

        tc.text = creds;
        tc.transform.position = new Vector3(0.5f, -.5f, 0);
        crawling = true;
    }
Пример #57
0
 /// <summary>
 /// Obtiene las referencias de los elementos de la interfaz
 /// </summary>
 private void GetReferencias()
 {
     if (m_txtTitulo == null)
     {
         m_txtTitulo = transform.FindChild("txtTitulo").GetComponent <GUIText>();
     }
     if (m_txtSubtitulo == null)
     {
         m_txtSubtitulo = transform.FindChild("txtSubtitulo").GetComponent <GUIText>();
     }
     if (m_txtNivel == null)
     {
         m_txtNivel = transform.FindChild("txtNivel").GetComponent <GUIText>();
     }
     if (m_txtNivelSombra == null)
     {
         m_txtNivelSombra = transform.FindChild("txtNivelSombra").GetComponent <GUIText>();
     }
     if (m_txtRecompensa == null)
     {
         m_txtRecompensa = transform.FindChild("txtRecompensa").GetComponent <GUIText>();
     }
     if (m_txtProgreso == null)
     {
         m_txtProgreso = transform.FindChild("BarraProgreso/txtProgreso").GetComponent <GUIText>();
     }
     if (m_txtProgresoSombra == null)
     {
         m_txtProgresoSombra = transform.FindChild("BarraProgreso/txtProgresoSombra").GetComponent <GUIText>();
     }
     if (m_barraProgreso == null)
     {
         m_barraProgreso = transform.FindChild("BarraProgreso/barra").GetComponent <GUITexture>();
     }
     if (m_barraProgresoFront == null)
     {
         m_barraProgresoFront = transform.FindChild("BarraProgreso/front").GetComponent <GUITexture>();
     }
     if (m_barraProgresoBack == null)
     {
         m_barraProgresoBack = transform.FindChild("BarraProgreso/back").GetComponent <GUITexture>();
     }
 }
Пример #58
0
    public void SetName(string name, int group)
    {
        myGuiText = Instantiate(prefabLabel, Vector3.zero, Quaternion.identity) as GUIText;
        if (null != myGuiText)
        {
            myGuiText.text = name;

            if (group == BaseNetwork.MainPlayer.TeamId)
            {
                myGuiText.material.color = Color.green;
            }
            else
            {
                Color32 col32 = ForceSetting.Instance.GetForceColor(group);
                Color   col   = new Color(col32.r / 255f, col32.g / 255f, col32.b / 255f, col32.a / 255f);
                myGuiText.material.color = col;
            }
        }
    }
Пример #59
0
    // Use this for initialization
    void Start()
    {
        playerReference = GameObject.FindWithTag("Player");

        // when spell is created, give it random damage
        // down to current weapon damage, up to double current weapon damage
        GameObject currentweapon = playerReference.GetComponent <PlayerStats> ().currentWeapon;
        int        currdamage    = currentweapon.GetComponent <WeaponStats>().damage;

        damage   = Random.Range(currdamage * 2, currdamage * 4);
        cooldown = Random.Range(10f, 20f);
        GetComponent <Renderer>().material.color = new Color(Random.value, Random.value, Random.value);
        ParticleSystem ps = GetComponent <ParticleSystem>();

        ParticleSystem.MainModule psmain = ps.main;
        psmain.startColor = GetComponent <Renderer>().material.color;

        popup = (GUIText)Instantiate(popupref);
    }
Пример #60
0
 void Start()
 {
     this.bullets = this.capacity;
     player       = Enemy.player.GetComponent <PlayerBehave>();
     ammoTxt      = player.ammoGUI;
     warningTxt   = player.warningGUI;
     updateAmmo();
     muzzle.SetActive(false);
     redIncrRate = 5f / overheatLimit;
     if (this.weaponModel == WeaponEnum.Rifle)
     {
         reloadDelay = modelGameObject.animation["handgunReload"].length;
     }
     else
     {
         reloadDelay = 2f;
     }
     //color1 = renderer.material.color;
 }