Example #1
0
	// Use this for initialization
	//void Start () {
	    
	//}
    void Start()
    {
        
       icon =  PlayerUIMgr.instance.AddHunterIcon();
       icon.GetComponent<BoundObject>().SetBoundTranform(this.transform);
       //icon.onClick.AddListener(this.GetComponent<NvigationGame>().Select);
       
        hunter_nav = this.GetComponent<NvigationGame>();

       name_text = PlayerUIMgr.instance.AddText();
       name_text.GetComponent<BoundObject>().SetBoundTranform(this.transform);
       name_text.GetComponent<BoundObject>().SetGap(new Vector2(0,20));
       hunter_name_ui = HunterListPanel.instance.AddHunterName("hunter1");
       hunter_name_ui.hunter = this;

       SetName("hunter1");

       icon.GetComponent<HunterUI>().hunter = this;
       floor_mask = 1 << 8 + 1 << 9 + 1 << 10;

       my_agent = this.transform.parent.GetComponent<NavMeshAgent>();

        //追跡フラッグをoff
       target = null;
       
        
    }
Example #2
0
    public IEnumerator FadeTextIn(Text textToFade)
    {
        float alpha = textToFade.GetComponent<Text>().color.a;

        for (float i = 0f; i < 1f; i += Time.deltaTime / aTime)
        {
            Color newColor = textToFade.GetComponent<Text>().color;
            newColor.a = Mathf.Lerp(alpha, 1, i);
            textToFade.GetComponent<Text> ().color = newColor;
            yield return null;
        }
    }
    void Start()
    {
        tempCol = new Color(255, 255, 255, 0);

        if(gameOverText != null)
        {
            victoryText = gameOverText.GetComponent<Text>();
            //victoryText.enabled = false;
            victoryOutline = victoryText.GetComponent<Outline>();
            victoryShadow = victoryText.GetComponent<Shadow>();
        }
    }
Example #4
0
    public IEnumerator FadeTextOut(Text textToFade)
    {
        float alpha = textToFade.GetComponent<Text>().color.a;

        float t = 0;
        for (float i = 1f; i > 0f; i -= Time.deltaTime / aTime)
        {
            t += Time.deltaTime / aTime;

            Color newColor = textToFade.GetComponent<Text>().color;
            newColor.a = Mathf.Lerp(alpha, 0, t);
            textToFade.GetComponent<Text>().color = newColor;
            yield return null;
        }
    }
Example #5
0
    //look at the current order list and make a Text for each
    public void createOrders()
    {
        int iCount = 0;
        foreach(Item i in orders.Keys){

            //making the order
            orderEntry = (Text)Instantiate(orderPrefab);
            orderEntry.name = i.getName(); //name the object
            int qty = orders[i];
            string temp = "x"+qty;
            temp+= " "+i.getName();
            orderEntry.text = temp; //assign the text

            priceField = orderEntry.transform.Find("Price").gameObject.GetComponent<Text>(); //find the Price-text child
            priceField.text = (qty*i.getPrice()).ToString("C");

            //positioning the order
            orderEntry.transform.SetParent(this.gameObject.transform); //make position relative to the orderview
            orderEntry.transform.localScale = Vector2.one;//this line stops the text from being huge
            orderEntry.GetComponent<RectTransform>().localPosition = new Vector2(50, y-(iCount*itemHt));
            iCount++;
        }

        if ((y - itemHt*iCount) < -maxHeight)
            contentPane.sizeDelta = new Vector2 (980, (-y + itemHt*iCount));
        else
            contentPane.sizeDelta = new Vector2 (980, maxHeight);
        updatePrice ();
    }
Example #6
0
  void fillText(string what, Text heading, Text contents) {
    heading.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, - accumulatedHeight);
    accumulatedHeight += heading.preferredHeight + spaceBetweenHeadingAndContents;
    contents.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, - accumulatedHeight);

    string data = Resources.Load("_StatsMatching/" + what).ToString().Trim();
    string[] lines = data.Split('\n');
    foreach (string line in lines) {
      string[] lineData = line.Split(',');
      string value = getValue(lineData);
      contents.text += lineData[2] + ": " + value + "\n";
    }
    contents.text = contents.text.Trim();
    accumulatedHeight += contents.preferredHeight + spaceBetweenCategories;
    contents.GetComponent<RectTransform>().sizeDelta = new Vector2(newWidth, contents.preferredHeight);
  }
Example #7
0
    private RigidBodyControls player; //Referance to the player

    #endregion Fields

    #region Methods

    void Start()
    {
        player = GetComponent<RigidBodyControls>();
        playerNumber = GetComponent<playerCharacter> ().ID;
        // Not the best way of doing this, but couldn't think of a clean, fast, robust way, that also accounted for
        // possible null refs if it tried to find the player before they spawned in
        if(playerNumber == 1)
        {
            dash = GameObject.Find("Txt_p1_Dashes").GetComponent<Text>();
            dash.GetComponent<Text>().enabled = true;
        }
        else if(playerNumber == 2)
        {
            dash = GameObject.Find("Txt_p2_Dashes").GetComponent<Text>();
            dash.GetComponent<Text>().enabled = true;
        }
        else if(playerNumber == 3)
        {
            dash = GameObject.Find("Txt_p3_Dashes").GetComponent<Text>();
            dash.GetComponent<Text>().enabled = true;
        }
        else
        {
            dash = GameObject.Find("Txt_p4_Dashes").GetComponent<Text>();
            dash.GetComponent<Text>().enabled = true;
        }
    }
Example #8
0
    // Use this for initialization
    void Start() {
		gameManager = GameObject.Find ("GameManager").GetComponent<Manager> ();
		distance = GameObject.Find ("DistanceToHole").GetComponent<Text> ();
		score = GameObject.Find ("Score").GetComponent<Text> ();
		name = GameObject.Find ("Name").GetComponent<Text> ();
		powerbar = GameObject.Find ("PowerSlider").GetComponent<Slider> ();
		gameManager.scoreboard = GameObject.Find ("Leaderboard").GetComponent<Leaderboard> ();

        distance.GetComponent<Text>().text = "Distance To Hole:" + distanceToHole;
        score.GetComponent<Text>().text = "Strokes:" + strokes;
		name.GetComponent<Text> ().text = PlayerPrefs.GetString("playerName");

		//Setup powerbar values
		powerbar.minValue = minHitPower;
		powerbar.maxValue = maxHitPower;

		//Ball pointer display
		ballPointer.SetActive (true);


		scoreTotal = PlayerPrefs.GetInt("totalScore");
		gameManager.scoreboard.updateLeaderboard (gameManager.getCurrentLevel(), strokes, scoreTotal);

		Debug.Log ("Beginning of level total: " + scoreTotal);
		//Debug.Log ("Hole Y Position: " + hole.transform.position.y);
		//Debug.Log ("Hole X Position: " + hole.transform.position.x);
    }
	public void Awake() {
		canvasGroupObj = new GameObject ("CanvasGroup");
		canvasGroupObj.transform.SetParent(gameObject.transform, false);
		canvasGroupObj.AddComponent<CanvasGroup>();
		canvasGroupObj.transform.localRotation = 
			Quaternion.FromToRotation(Vector3.forward, Vector3.down);
		
		canvasGroupObj.transform.localScale = Vector3.one * 0.002f;
		
		/*******************************************************/
		
		canvasObj = new GameObject ("Canvas");
		canvasObj.transform.SetParent (canvasGroupObj.transform, false);
		
		Canvas canvas = canvasObj.AddComponent<Canvas> ();
		canvas.renderMode = RenderMode.WorldSpace;
		
		canvasObj.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
		/*********************************************************/
		
		textObj = new GameObject ("Text");
		textObj.transform.SetParent (canvasObj.transform, false);
		
		_text = textObj.AddComponent<Text> ();
		
		_text.GetComponent<Text> ().alignment = TextAnchor.MiddleCenter;
		
		/*********************************************************/
		
		//_text.material = ShortcutUtil.GetMaterial ();
		_text.material = Materials.GetTextLayer (_text.material, 1);
		/*********************************************************/
		
	}
Example #10
0
//===========================================================
// 関数定義
//===========================================================
	//---------------------------------------------------
	// コンストラクタ
	//---------------------------------------------------
	void Awake()
	{
		m_CellList	= new List<CZParamCell>();
		m_ColName	= transform.FindChild("InputName").FindChild("Text").GetComponent<Text>();
		m_SelType	= transform.FindChild("SelType").GetComponent<Dropdown>();

		m_vColSize	= m_ColName.GetComponent<RectTransform>().sizeDelta;
	}
Example #11
0
 // Use this for initialization
 void Start()
 {
     nameHolder = Instantiate(namePref);
     nameHolder.GetComponent<Text>().text = objName;
     nameHolder.transform.parent = GameObject.Find("Canvas").transform;
     valHolder = Instantiate(valPref);
     valHolder.GetComponent<Text>().text = value;
     valHolder.transform.parent = GameObject.Find("Canvas").transform;
 }
Example #12
0
	public void Awake()
	{
		opcionesUIJuego = GameCenter.InstanceRef.CanvasUIJuego.GetComponent<OpcionesCanvasUIJuego> ();
		textoLateral = opcionesUIJuego.panelLateral.GetComponentInChildren<Text>();
		textoLateralOpciones = textoLateral.GetComponent<TextoLateralOpciones> ();
		textoInferior = opcionesUIJuego.panelInferior.GetComponentInChildren<Text>();
		textoInferiorOpciones = textoInferior.GetComponent<TextoInferiorOpciones> ();
		panelPreguntasOpciones = GameObject.Find ("PanelPreguntas").GetComponent<PanelPreguntasOpciones> ();
		listaPreguntas = opcionesUIJuego.panelInferior.GetComponentInChildren<ScrollRect> ().GetComponent<ListaPreguntas> ();
		panelObjetosOpciones = opcionesUIJuego.panelObjetos.GetComponent<PanelObjetosOpciones> ();
		imagenCargando = opcionesUIJuego.imagenCargando.GetComponent<PantallaCarga> ();
	}
Example #13
0
	private IEnumerator PlayFloatingTextAnimation(Text t, int damageAmount) {
		if (t == null) {
			yield break;
		}

		t.text = damageAmount.ToString();
		t.enabled = true;

		//TODO: optimize
		Animator a = t.GetComponent<Animator>();
		a.Play("TextFloat" + Random.Range(1, _textAnimationsCount + 1), 0, 0);
		yield return null;
		yield return new WaitForSeconds(a.GetCurrentAnimatorStateInfo(0).length);

		t.enabled = false;
	}
Example #14
0
 public static IEnumerator Glow(Text text)
 {
     Outline outline = text.GetComponent<Outline>();
     if (outline != null) {
         outline.enabled = true;
         for (int i = 0; i<12; i++) {
             outline.effectDistance += Vector2.one * .25f;
             yield return new WaitForSeconds(.04f);
         }
         for (int i = 0; i<10; i++) {
             outline.effectDistance -= Vector2.one * .3f;
             yield return new WaitForSeconds(.1f);
         }
         outline.effectDistance = Vector2.zero;
         outline.enabled = false;
     }
     yield return null;
 }
Example #15
0
    public void Awake()
    {
        imagenCargando = GameObject.Find ("ImagenCargando");
        panelLateral = GameObject.Find ("PanelLateral");
        panelInferior = GameObject.Find ("PanelInferior");
        botonDiario = GameObject.Find ("BotonDiario");
        panelDirecciones = GameObject.Find ("PanelDirecciones");
        panelObjetos = GameObject.Find ("PanelObjetos");
        panelLibro = GameObject.Find ("Libro");

        textoLateral = panelLateral.GetComponentInChildren<Text>();
        textoLateralOpciones = textoLateral.GetComponent<TextoLateralOpciones> ();
        textoInferior = panelInferior.GetComponentInChildren<Text>();
        textoInferiorOpciones = textoInferior.GetComponent<TextoInferiorOpciones> ();
        panelPreguntasOpciones = GameObject.Find ("PanelPreguntas").GetComponent<PanelPreguntasOpciones> ();
        listaPreguntas = panelInferior.GetComponentInChildren<ScrollRect> ().GetComponent<ListaPreguntas> ();
        panelObjetosOpciones = panelObjetos.GetComponent<PanelObjetosOpciones> ();
    }
    static public void FadeAll(this GameObject that, float fade, float time)
    {
        Image iS = that.GetComponent <Image>();

        iS?.DOKill(true);
        iS?.GetComponent <Image>().DOFade(fade, time);
        Text tS = that.GetComponent <Text>();

        tS?.DOKill(true);
        tS?.GetComponent <Image>().DOFade(fade, time);
        foreach (Image i in that.GetComponentsInChildren <Image>())
        {
            i.DOKill(true);
            i.DOFade(fade, time);
        }
        foreach (Text t in that.GetComponentsInChildren <Text>())
        {
            t.DOKill(true);
            t.DOFade(fade, time);
        }
    }
Example #17
0
 // Use this for initialization
 void Start()
 {
     imageResume = imageResume.GetComponent<Image>();
     imageExit = imageExit.GetComponent<Image>();
     player = player.GetComponent<UnitPlayer>();
     textResume = textResume.GetComponent<Text>();
     textExit = textExit.GetComponent<Text>();
     menu = menu.GetComponent<Canvas>();
     images = new Image[TOTAL_OPTIONS];
     texts = new Outline[TOTAL_OPTIONS];
     images[0] = imageResume;
     images[1] = imageExit;
     texts[0] = textResume.GetComponent<Outline>();
     texts[1] = textExit.GetComponent<Outline>();
     images[0].enabled = true;
     texts[0].enabled = true;
     for (int i = 0; i < TOTAL_OPTIONS; i++)
     {
         images[i].enabled = false;
         texts[i].enabled = false;
     }
     menu.enabled = false;
 }
Example #18
0
 void Awake()
 {
     text = transform.FindChild ("Text").GetComponent<Text> ();
     textContainer = text.GetComponent<RectTransform>();
     scrollbar = GetComponentInChildren<Scrollbar> ();
 }
Example #19
0
	void HealthUpdate(GameObject fighter, Text fightertext){
		if (fighter.GetComponent<FighterScript> ().health <= 0)
			fighter.GetComponent<FighterScript> ().health = 0;
		fightertext.GetComponent<Text> ().text = fighter.GetComponent<FighterScript> ().health + "/" + fighter.GetComponent<FighterScript> ().maxhealth;
	}
Example #20
0
    // Update is called once per frame
    void Update()
    {
        Clicks();
        UITextTypeWriter UI     = Asgore.GetComponent <UITextTypeWriter> ();
        UITextTypeWriter UIName = Name.GetComponent <UITextTypeWriter> ();
        UITextTypeWriter UI2    = Asgore2.GetComponent <UITextTypeWriter> ();
        UITextTypeWriter UIW    = Wait.GetComponent <UITextTypeWriter> ();

        if (UIName.Finished)
        {
            UIW.ChangeText("", 0.8f);
            if (UIW.Finished)
            {
                Asgore2.enabled = true;
                UI2.ChangeText("Stay determined...", 0f);
                UIName.Finished = false;
                UIW.Finished    = false;
            }
        }
        if (UI2.Finished)
        {
            AsgoreTxt    = 3;
            UI2.Finished = false;
        }


        if (Input.GetAxisRaw("Submit") == 1)
        {
            if (AsgoreTxt == 1)
            {
                if (NOClicks > 1)
                {
                    if (UI.Finished)
                    {
                        NOClicks       = 1;
                        Name.enabled   = true;
                        Asgore.enabled = false;
                        UIName.ChangeText("Frisk!", 0f);
                        AsgoreTxt = 2;
                    }
                }
            }
            if (AsgoreTxt == 3)
            {
                if (NOClicks > 1)
                {
                    NOClicks = 1;
                    //UI.StopAllCoroutines ();
                    Asgore.enabled  = false;
                    Asgore2.enabled = false;
                    Name.enabled    = false;
                    Wait.enabled    = false;
                    AsgoreTxt       = 4;
                }
            }
            if (AsgoreTxt == 4)
            {
                if (NOClicks > 1)
                {
                    NOClicks  = 1;
                    AsgoreTxt = 0;
                    SceneManager.LoadScene(0);
                }
            }
        }
    }
Example #21
0
 void UpdateButtonsVisualState()
 {
     on.GetComponent <Text>().gameObject.SetActive(!Options.isMusicMuted);
     off.GetComponent <Text>().gameObject.SetActive(Options.isMusicMuted);
 }
Example #22
0
 // 1
 public void ShowWaveClearBonus()
 {
     waveClearText.GetComponent <Text>().enabled = true;
     StartCoroutine("hideWaveClearBonus");
 }
Example #23
0
    /// <summary>
    ///告警时间筛选
    /// </summary>
    public void ScreeningStartTimeAlaim(DateTime dateTime)
    {
        pegeNumText.text = "1";
        SaveSelection();
        SeachPerItems.Clear();
        string key      = InputPerAlarm.text.ToString().ToLower();
        string DealTime = DealTimeText.GetComponent <Text>().text;

        DateTime NewStartTime = Convert.ToDateTime(dateTime);

        DateTime CurrentEndTime = Convert.ToDateTime(DealTime);
        DateTime NewEndTime     = CurrentEndTime.AddHours(24);

        for (int i = 0; i < AlarmItem.Count; i++)
        {
            DateTime AlarmTime  = AlarmItem[i].CreateTime;
            bool     IsTime     = DateTime.Compare(NewStartTime, NewEndTime) < 0;
            bool     ScreenTime = DateTime.Compare(NewStartTime, AlarmTime) <= 0 && DateTime.Compare(NewEndTime, AlarmTime) >= 0;
            if (IsTime)
            {
                if (key == "" && ScreenTime)
                {
                    SeachPerItems.Add(AlarmItem[i]);
                }
                else if ((AlarmItem[i].Tag.Code.ToString().ToLower().Contains(key)) || AlarmItem[i].Personnel.Name.ToLower().Contains(key))
                {
                    if (ScreenTime)
                    {
                        SeachPerItems.Add(AlarmItem[i]);
                    }
                }
            }
            else
            {
                DateTime time1 = NewStartTime.AddHours(24);

                bool Time2 = DateTime.Compare(NewStartTime, AlarmTime) <= 0 && DateTime.Compare(NewEndTime, AlarmTime) >= 0;
                if (key == "" && Time2)
                {
                    SeachPerItems.Add(AlarmItem[i]);
                }
                else if ((AlarmItem[i].Tag.Code.ToString().ToLower().Contains(key)) || AlarmItem[i].Personnel.Name.ToLower().Contains(key))
                {
                    if (Time2)
                    {
                        SeachPerItems.Add(AlarmItem[i]);
                    }
                }
                Invoke("ChangeEndTime", 0.1f);
            }
        }
        if (SeachPerItems.Count == 0)
        {
            promptText.gameObject.SetActive(true);
            pegeNumText.text   = "1";
            pegeTotalText.text = "1";
        }
        else
        {
            promptText.gameObject.SetActive(false);
            //TotaiLine(SeachPerItems);
            GetPersonnelAlarmPage(SeachPerItems);
        }
    }
Example #24
0
 // Use this for initialization
 void Start()
 {
     texto.GetComponent <Text>().text = "";
 }
Example #25
0
 public void Hero()
 {
     Character.GetComponent <Text>().text = "Hero";
     character = 1;
 }
    // Update is called once per frame
    void Update()
    {
        if (present)
        {
            questText.enabled = true;

            if (quest1)
            {
                if (Input.anyKeyDown)
                {
                    keyCheck = true;
                }
                if (keyCheck)
                {
                    if (Input.GetKeyDown(KeyCode.Z) && questEnabled && keyCheck == true)
                    {
                        c1Pressed = true;
                        keyCheck  = false;
                    }
                    if (Input.GetKeyDown(KeyCode.C) && c1Pressed && keyCheck == true)
                    {
                        e1Pressed = true;
                        keyCheck  = false;
                    }
                    else if (Input.GetKeyDown(KeyCode.Q) == false && Input.GetKeyDown(KeyCode.B) == false && keyCheck == true)
                    {
                        c1Pressed = false;
                        e1Pressed = false;
                        keyCheck  = false;
                    }

                    if (Input.GetKeyDown(KeyCode.B) && e1Pressed && c1Pressed && keyCheck == true)
                    {
                        g1Pressed = true;
                        keyCheck  = false;
                    }
                    else if (Input.GetKeyDown(KeyCode.Q) == false && keyCheck == true)
                    {
                        c1Pressed = false;
                        e1Pressed = false;
                        keyCheck  = false;
                    }

                    if ((Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.Comma)) && e1Pressed && c1Pressed && g1Pressed && keyCheck == true)
                    {
                        c2Pressed = true;
                        keyCheck  = false;
                    }
                    else if (keyCheck == true)
                    {
                        c1Pressed = false;
                        e1Pressed = false;
                        g1Pressed = false;
                        keyCheck  = false;
                    }

                    if (c2Pressed)
                    {
                        questComplete = true;
                        questTextObj.GetComponent <Text> ().text = "Good job!!!";
                        questEnabled = false;
                    }
                }
            }

            if (quest2)
            {
                if (Input.anyKeyDown && timerStart == false)
                {
                    timerStart = true;
                }
                if (timerStart == true)
                {
                    timer++;

                    if (Input.GetKeyDown(KeyCode.Z) ||
                        Input.GetKeyDown(KeyCode.X) ||
                        Input.GetKeyDown(KeyCode.C) ||
                        Input.GetKeyDown(KeyCode.V) ||
                        Input.GetKeyDown(KeyCode.B) ||
                        Input.GetKeyDown(KeyCode.N) ||
                        Input.GetKeyDown(KeyCode.M) ||
                        Input.GetKeyDown(KeyCode.Q))
                    {
                        noteCount += 1;
                    }

                    if (Input.GetKeyDown(KeyCode.S) ||
                        Input.GetKeyDown(KeyCode.D) ||
                        Input.GetKeyDown(KeyCode.G) ||
                        Input.GetKeyDown(KeyCode.H) ||
                        Input.GetKeyDown(KeyCode.J))
                    {
                        noteCount -= 1;
                    }

                    if (timer > timerWindow && questEnabled == true)
                    {
                        if (noteCount > 35)
                        {
                            questComplete = true;
                            questTextObj.GetComponent <Text> ().text = "Wow!! Amazing!";
                            questEnabled = false;
                        }

                        if (noteCount <= 35)
                        {
                        }


                        timer      = 0f;
                        timerStart = false;
                        noteCount  = 0;
                    }
                }
            }
            if (quest3)
            {
                if (Input.GetKeyDown(KeyCode.X) && questEnabled)
                {
                    d1Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.X))
                {
                    d1Pressed = false;
                }

                if (Input.GetKeyDown(KeyCode.W) && questEnabled)
                {
                    d2Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.W))
                {
                    d2Pressed = false;
                }

                if (Input.GetKeyDown(KeyCode.V))
                {
                    f1Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.V))
                {
                    f1Pressed = false;
                }
                if (Input.GetKeyDown(KeyCode.R))
                {
                    f2Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.R))
                {
                    f2Pressed = false;
                }

                if (Input.GetKeyDown(KeyCode.N))
                {
                    a1Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.N))
                {
                    a1Pressed = false;
                }
                if (Input.GetKeyDown(KeyCode.Y))
                {
                    a2Pressed = true;
                }
                if (Input.GetKeyUp(KeyCode.Y))
                {
                    a2Pressed = false;
                }

                if (d1Pressed || d2Pressed)
                {
                    dInteract = true;
                }
                else
                {
                    dInteract = false;
                }


                if (f1Pressed || f2Pressed)
                {
                    fInteract = true;
                }
                else
                {
                    fInteract = false;
                }


                if (a1Pressed || a2Pressed)
                {
                    aInteract = true;
                }
                else
                {
                    aInteract = false;
                }

                if (dInteract && fInteract && aInteract)
                {
                    questTextObj.GetComponent <Text> ().text = "Wow! That was beautiful.";
                    questComplete = true;
                    questEnabled  = false;
                }
            }

            if (quest4)
            {
                if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    as1Pressed = true;
                }



                if (as1Pressed)
                {
                    questTextObj.GetComponent <Text> ().text = "That's it!!";
                    questComplete = true;
                    questEnabled  = false;
                }
            }

            if (quest5)
            {
                if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.Alpha3))
                {
                    ds1Pressed = true;
                }

                if (Input.GetKeyDown(KeyCode.G) || Input.GetKeyDown(KeyCode.Alpha5))
                {
                    fs1Pressed = true;
                }

                if (Input.GetKeyDown(KeyCode.H) || Input.GetKeyDown(KeyCode.Alpha6))
                {
                    gs1Pressed = true;
                }

                if (Input.GetKeyDown(KeyCode.N) || Input.GetKeyDown(KeyCode.Y))
                {
                    a1Pressed = true;
                }


                if (ds1Pressed && fs1Pressed && gs1Pressed && a1Pressed && questEnabled)
                {
                    questTextObj.GetComponent <Text> ().text = "Damn! That was impressive.";
                    questComplete = true;
                    questEnabled  = false;
                }
            }

            if (quest6)
            {
                if (CheckF() && CheckA() && CheckC() && questComplete == false)
                {
                    aInteract = true;
                    questTextObj.GetComponent <Text> ().text = ":O!";
                }

                if (CheckF() && CheckGs() && CheckC() && questComplete == false)
                {
                    gsInteract = true;
                    quest6TextObj.GetComponent <Text> ().text = ":O!";
                }

                if (questComplete)
                {
                    aInteract = false;
                }

                if (aInteract && gsInteract)
                {
                    questComplete = true;
                    questEnabled  = false;

                    questTextObj.GetComponent <Text> ().text  = ":O!!!!!";
                    quest6TextObj.GetComponent <Text> ().text = ":O!!!!!";
                }
            }
        }
        else
        {
            questText.enabled = false;
        }

        questText.transform.LookAt(player.transform);
    }
Example #27
0
    //Calcola i punti fatti in questo livello in base al tempo rimasto
    public void LevelComplete()
    {
        print("StarsInTheScene: " + LevelManager.StarsInTheScene + " StarsGeted:" + _StarsGeted);

        if (_StarsGeted > LevelManager.StarsInTheScene)
        {
            LevelManager.StarsInTheScene = _StarsGeted;                                            //Per sicurezza
        }
        //CALCOLO DEI PUNTI
        float PointsByRemainingTime = Mathf.Abs(Mathf.Ceil((GameManager.Timer.sceneTimer / GameManager.Timer.TimerAtStart) * 1000)); //Sempre meno di 1000, diventa 1000 se impiegati 0 secondi
        int   PointsByStars         = 1500 / Mathf.Abs(LevelManager.StarsInTheScene - _StarsGeted + 1) + 1;                          //Al massimo 1500 (se prende tutte le stelle nel livello)

        if (_StarsGeted >= LevelManager.StarsInTheScene)
        {
            PointsByStars += 700;                                                  //Se sono state prese tutte le stelline, aggiungo un bonus di 700 punti
        }
        int PointsByEnergy   = Mathf.Abs((int)(GameManager.m_Character.PlayerEnergy * 500));
        int PointsByDataTime = Mathf.Min(GameManager.GiorniPassati * 2, 1000);                                         //Punti in base ai mesi del gioco, massimo 1000

        if (GameManager.ThisLevelManager.SecretAreasInThisLevel < 0)                                                   //Se c'erano aree segrete
        {
            if (ActivationTrigger.endLevelSecretsAreaUI.founded < GameManager.ThisLevelManager.SecretAreasInThisLevel) //Se non sono state trovate tutte le aree segrete
            {
                RemovePoints(500);
            }
            else
            {
                AddPoints(500);
            }
        }



        //Calcolo il punteggio in base alle stelle prese e al tempo rimasto (più PointsByOther e PointsByDataTime)
        ThisLevelActualPoints = ((int)PointsByRemainingTime + PointsByStars + PointsByOther + PointsByEnergy + PointsByDataTime + GameManager.ThisLevelManager.AddRemovePointsAtEnd);
        print("PointsByDataTime:" + PointsByDataTime + " PointsByRemainingTime;" + PointsByRemainingTime + " PointsByStars:" + PointsByStars + " PointsByEnergy:" + PointsByEnergy + "   ThisLevelActualPoints:<color=#FFFFFFF>" + ThisLevelActualPoints + "</color>");

        //Alla fine il punteggio massimo può arrivare a circa 5500, se prese tutte le stelline, tutte le aree segrete e con energia massima, dunque
        //un buon punteggio potrà arrivare a circa 4000

        _GetedPoints.GetComponent <W_numberAnimation>().SetCount(0, ThisLevelActualPoints, 0);                            //Imposto le stelline con l'animazione
        _GetedStars.GetComponent <W_numberAnimation>().SetCount(0, _StarsGeted, 1);                                       //Imposto le stelline con l'animazione
        _TimeSummary.GetComponent <W_numberAnimation>().SetCount(0, (int)GameManager.Timer.sceneTimer, 1);                //Imposto il tempo rimasto con l'animazione
        GameManager.Timer.transform.GetComponent <W_numberAnimation>().enabled = true;
        GameManager.Timer.transform.GetComponent <W_numberAnimation>().SetCount((int)GameManager.Timer.sceneTimer, 0, 1); //Decremento il tempo rimasto con l'animazione
        _TotalStars.text = "/" + LevelManager.StarsInTheScene.ToString();


        Stars[0].SetActive(true);//Se completato, almeno una stella
        Stars[1].SetActive(false);
        Stars[2].SetActive(false);
        PerfectIcon.SetActive(false);

        //Qui calcolo e salvo il punteggio per assegnare le stelle e la corona
        if (ThisLevelActualPoints > GameManager.Star02Points)
        {
            Stars[1].SetActive(true);
        }
        if (ThisLevelActualPoints > GameManager.Star03Points)
        {
            Stars[2].SetActive(true);
        }
        if (ThisLevelActualPoints > GameManager.CrowPoints)
        {
            PerfectIcon.SetActive(true);
        }


        //Compara i vecchi punti del livello con quelli appena fatti
        OldNewLevelPOintsComparation();

        GameManager.m_Character.DissolveRex();
    }
Example #28
0
 // Update is called once per frame
 public void SetText(string text)
 {
     damageText.GetComponent <Text>().text = text;
 }
Example #29
0
 void Start()
 {
     manager = gameObject.GetComponent <GameManager> ();
     nText   = eventInfo.GetComponent <Text> ();
     nTitle  = titleText.GetComponent <Text> ();
 }
Example #30
0
    // Update is called once per frame
    void Update()
    {
        if (name == "Score")
        {
            txt.text = "" + LevelManager.Score;
        }
        if (name == "BestScore")
        {
            txt.text = "Best score:" + PlayerPrefs.GetInt("Score" + PlayerPrefs.GetInt("OpenLevel"));
        }

        if (name == "Limit")
        {
            if (LevelManager.Instance.limitType == LIMIT.MOVES)
            {
                txt.text = "" + LevelManager.THIS.Limit;
                txt.transform.localScale = Vector3.one;
                if (LevelManager.THIS.Limit <= 5)
                {
                    txt.color = new Color(216f / 255f, 0, 0);
                    txt.GetComponent <Outline> ().effectColor = Color.white;
                    if (!alert)
                    {
                        alert = true;
                        SoundBase.Instance.GetComponent <AudioSource> ().PlayOneShot(SoundBase.Instance.alert);
                    }
                }
                else
                {
                    alert     = false;
                    txt.color = Color.white;
                    txt.GetComponent <Outline> ().effectColor = new Color(148f / 255f, 61f / 255f, 95f / 255f);
                }
            }
            else
            {
                int minutes = Mathf.FloorToInt(LevelManager.THIS.Limit / 60F);
                int seconds = Mathf.FloorToInt(LevelManager.THIS.Limit - minutes * 60);
                txt.text = "" + string.Format("{0:00}:{1:00}", minutes, seconds);
                txt.transform.localScale = Vector3.one * 0.68f;
                if (LevelManager.THIS.Limit <= 30 && LevelManager.THIS.gameStatus == GameState.Playing)
                {
                    txt.color = new Color(216f / 255f, 0, 0);
                    txt.GetComponent <Outline> ().effectColor = Color.white;
                    if (lastTime + 30f < Time.time)
                    {
                        lastTime = Time.time;
                        SoundBase.Instance.GetComponent <AudioSource> ().PlayOneShot(SoundBase.Instance.timeOut);
                    }
                }
                else
                {
                    txt.color = Color.white;
                    txt.GetComponent <Outline> ().effectColor = new Color(148f / 255f, 61f / 255f, 95f / 255f);
                }
            }
        }
        if (name == "TargetBlocks")
        {
            txt.text = "" + LevelManager.THIS.TargetBlocks;
        }
        if (name == "TargetIngr1")
        {
            txt.text = "" + LevelManager.THIS.ingrCountTarget [0];
        }
        if (name == "TargetIngr2")
        {
            txt.text = "" + LevelManager.THIS.ingrCountTarget [1];
        }
        if (name == "Lifes")
        {
            txt.text = "" + InitScript.Instance.GetLife();
        }

        if (name == "Gems")
        {
            txt.text = "" + InitScript.Gems;
        }
        if (name == "TargetScore")
        {
            txt.text = "" + LevelManager.THIS.star1;
        }
        if (name == "Level")
        {
            txt.text = "" + PlayerPrefs.GetInt("OpenLevel");
        }
        if (name == "TargetDescription1")
        {
            if (LevelManager.THIS.target == Target.SCORE)
            {
                txt.text = LevelManager.THIS.targetDiscriptions [0].Replace("%n", "" + LevelManager.THIS.star1);
            }
            else if (LevelManager.THIS.target == Target.BLOCKS)
            {
                txt.text = LevelManager.THIS.targetDiscriptions [1];
            }
            else if (LevelManager.THIS.target == Target.INGREDIENT)
            {
                txt.text = LevelManager.THIS.targetDiscriptions [2];
            }
            else if (LevelManager.THIS.target == Target.COLLECT)
            {
                txt.text = LevelManager.THIS.targetDiscriptions [3];
            }
        }
    }
Example #31
0
    public void CalcularCostos()
    {
        bool disableInput = false;

        if (costoCSInput.text == "" && costoCWInput.text == "")
        {
            Error_Text.GetComponent <UnityEngine.UI.Text>().text = "Costos vacios";
        }
        else if (costoCSInput.text == "")
        {
            double costoCW = double.Parse(costoCWInput.text);
            if (costoCW < 0)
            {
                Error_Text.GetComponent <UnityEngine.UI.Text>().text = "El costo de espera debe ser positivo";
            }
            else
            {
                double costoEspera = l * costoCW;
                double costoTotal  = costoEspera;
                CostoService_Result.GetComponent <UnityEngine.UI.Text>().text = "0";
                CostoEspera_Result.GetComponent <UnityEngine.UI.Text>().text  = costoEspera.ToString("0.0000");
                CostoTotal_Result.GetComponent <UnityEngine.UI.Text>().text   = costoTotal.ToString("0.0000");
                disableInput = true;
            }
        }
        else if (costoCWInput.text == "")
        {
            double costoCS = double.Parse(costoCSInput.text);
            if (costoCS < 0)
            {
                Error_Text.GetComponent <UnityEngine.UI.Text>().text = "El costo de servicio debe ser positivo";
            }
            else
            {
                double costoServicio = costoCS;
                double costoTotal    = costoServicio;
                CostoService_Result.GetComponent <UnityEngine.UI.Text>().text = costoServicio.ToString("0.0000");
                CostoEspera_Result.GetComponent <UnityEngine.UI.Text>().text  = "0";
                CostoTotal_Result.GetComponent <UnityEngine.UI.Text>().text   = costoTotal.ToString("0.0000");
                disableInput = true;
            }
        }
        else
        {
            double costoCS = double.Parse(costoCSInput.text);
            double costoCW = double.Parse(costoCWInput.text);

            if (costoCS < 0 || costoCW < 0)
            {
                Error_Text.GetComponent <UnityEngine.UI.Text>().text = "Los costos deben de ser positivos";
            }
            else
            {
                double costoService = costoCS;
                double costoEspera  = l * costoCW;
                double costoTotal   = costoService + costoEspera;


                CostoService_Result.GetComponent <UnityEngine.UI.Text>().text = costoService.ToString("0.0000");
                CostoEspera_Result.GetComponent <UnityEngine.UI.Text>().text  = costoEspera.ToString("0.0000");
                CostoTotal_Result.GetComponent <UnityEngine.UI.Text>().text   = costoTotal.ToString("0.0000");
                disableInput = true;
            }
        }

        if (disableInput)
        {
            Error_Text.GetComponent <UnityEngine.UI.Text>().text = "";
            costoCSInput.interactable          = false;
            costoCWInput.interactable          = false;
            CalcularCostos_Button.interactable = false;
        }
    }
Example #32
0
    // Find all the WheelColliders down in the hierarchy.
    void Start()
    {
        carBodyRigidbody = carObject.GetComponent <Rigidbody>();
        wd       = carObject.GetComponent <WheelDrive>();
        m_Wheels = carObject.GetComponentsInChildren <WheelCollider>();

        Debug.Log(Application.persistentDataPath + Path.DirectorySeparatorChar + "parameter.json");
        string jsonStr = "";

        if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "parameter.json"))
        {
            jsonStr = File.ReadAllText(Application.persistentDataPath + Path.DirectorySeparatorChar + "parameter.json");
        }
        else
        {
            jsonStr = Resources.Load <TextAsset>("parameter").text;
        }
        parameterJson    = MiniJSON.jsonDecode(jsonStr) as Hashtable;
        slidersMultiples = new Dictionary <string, InputField>();
        foreach (Slider slider in allSliders)
        {
            slider.value = -1;
            InputField inputField = Instantiate(inputFieldPrefab);
            inputField.gameObject.SetActive(true);
            inputField.transform.parent = slider.transform;
            inputField.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
            inputField.onValueChanged.AddListener(delegate
            {
                slider.maxValue = float.Parse(inputField.text);
                parameterJson[slider.name + "_Times"] = inputField.text;
                SaveParameter();
            });
            (inputField.placeholder as Text).text = "倍数";
            slidersMultiples.Add(slider.name, inputField);

            Text text = Instantiate(textPrefab);
            text.name = slider.name + "Text";
            text.gameObject.SetActive(true);
            text.transform.parent = slider.transform;
            text.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);

            slider.onValueChanged.AddListener(delegate
            {
                SliderValueChange(slider.name, slider.value);
                parameterJson[slider.name] = slider.value;
                text.text = GetParameterAnnotation(slider.name) + "(" + slider.value + ") = " + slider.value + "  ";
                SaveParameter();
            });
            if (!parameterJson.ContainsKey(slider.name))
            {
                parameterJson.Add(slider.name, slider.value);
            }
            if (!parameterJson.ContainsKey(slider.name + "_Times"))
            {
                parameterJson.Add(slider.name + "_Times", inputField.text);
            }
            inputField.text = parameterJson[(slider.name + "_Times")].ToString();
            slider.maxValue = float.Parse(inputField.text);
            slider.value    = float.Parse(parameterJson[slider.name].ToString());
        }
        inputFieldPrefab.gameObject.SetActive(false);
        textPrefab.gameObject.SetActive(false);

        List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

        for (int i = 0; i < 3; i++)
        {
            options.Add(new Dropdown.OptionData(((DriveType)i).ToString()));
        }
        deiveTypeInput.options = options;
        deiveTypeInput.onValueChanged.AddListener(delegate
        {
            DriveTypeChange();
        });
        deiveTypeInput.value = 0;

        ParameterShowableChange();
    }
Example #33
0
 public void Goal(int goalNumber)//when you get a prize, goal()
 {
     this.goal += goalNumber;
     scoreTextObject.GetComponent <Text>().text = "score:" + goal;
 }
Example #34
0
    void Update()
    {
        if (tooltip && tooltip.activeSelf == true)
        {
            Vector2 tooltipPos = Input.mousePosition;
            tooltipPos.x += 7;
            tooltip.transform.position = tooltipPos;
        }
        if (!player)
        {
            return;
        }
        //itemIcons[0].GetComponent<Image>().sprite = db.usableItem[player.GetComponent<Inventory>().itemSlot[0]].iconSprite;

        for (int a = 0; a < itemIcons.Length; a++)
        {
            itemIcons[a].GetComponent <Image>().sprite = db.usableItem[player.GetComponent <InventoryC>().itemSlot[a]].iconSprite;
            itemIcons[a].GetComponent <Image>().color  = db.usableItem[player.GetComponent <InventoryC>().itemSlot[a]].spriteColor;
        }

        for (int q = 0; q < itemQty.Length; q++)
        {
            string qty = player.GetComponent <InventoryC>().itemQuantity[q].ToString();
            if (qty == "0")
            {
                qty = "";
            }
            itemQty[q].GetComponent <Text>().text = qty;
        }

        for (int b = 0; b < equipmentIcons.Length; b++)
        {
            equipmentIcons[b].GetComponent <Image>().sprite = db.equipment[player.GetComponent <InventoryC>().equipment[b]].iconSprite;
            equipmentIcons[b].GetComponent <Image>().color  = db.equipment[player.GetComponent <InventoryC>().equipment[b]].spriteColor;
        }

        if (weaponIcons)
        {
            weaponIcons.GetComponent <Image>().sprite = db.equipment[player.GetComponent <InventoryC>().weaponEquip].iconSprite;
            weaponIcons.GetComponent <Image>().color  = db.equipment[player.GetComponent <InventoryC>().weaponEquip].spriteColor;
        }
        if (subWeaponIcons)
        {
            subWeaponIcons.GetComponent <Image>().sprite = db.equipment[player.GetComponent <InventoryC>().subWeaponEquip].iconSprite;
            subWeaponIcons.GetComponent <Image>().color  = db.equipment[player.GetComponent <InventoryC>().subWeaponEquip].spriteColor;
        }
        if (armorIcons)
        {
            armorIcons.GetComponent <Image>().sprite = db.equipment[player.GetComponent <InventoryC>().armorEquip].iconSprite;
            armorIcons.GetComponent <Image>().color  = db.equipment[player.GetComponent <InventoryC>().armorEquip].spriteColor;
        }
        if (accIcons)
        {
            accIcons.GetComponent <Image>().sprite = db.equipment[player.GetComponent <InventoryC>().accessoryEquip].iconSprite;
            accIcons.GetComponent <Image>().color  = db.equipment[player.GetComponent <InventoryC>().accessoryEquip].spriteColor;
        }
        if (moneyText)
        {
            moneyText.GetComponent <Text>().text = player.GetComponent <InventoryC>().cash.ToString();
        }
    }
    private void SetupText()
    {
        GameObject GOPlotXMinText = new GameObject("XMin", typeof(Text));
        GameObject GOPlotXMaxText = new GameObject("XMax", typeof(Text));
        GameObject GOPlotYMinText = new GameObject("YMin", typeof(Text));
        GameObject GOPlotYMaxText = new GameObject("YMax", typeof(Text));
        GameObject GOWarningText  = new GameObject("Warning", typeof(Text));

        GOPlotXMinText.transform.SetParent(transform, false);
        GOPlotXMaxText.transform.SetParent(transform, false);
        GOPlotYMinText.transform.SetParent(transform, false);
        GOPlotYMaxText.transform.SetParent(transform, false);
        GOWarningText.transform.SetParent(transform, false);
        PlotXMinText = GOPlotXMinText.GetComponent <Text>();
        PlotXMaxText = GOPlotXMaxText.GetComponent <Text>();
        PlotYMinText = GOPlotYMinText.GetComponent <Text>();
        PlotYMaxText = GOPlotYMaxText.GetComponent <Text>();
        WarningText  = GOWarningText.GetComponent <Text>();

        PlotYMaxText.alignment = TextAnchor.MiddleLeft;
        PlotYMinText.alignment = TextAnchor.MiddleLeft;
        PlotXMaxText.alignment = TextAnchor.MiddleRight;
        PlotXMinText.alignment = TextAnchor.MiddleLeft;
        WarningText.alignment  = TextAnchor.MiddleCenter;

        PlotYMaxText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
        PlotYMinText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
        PlotXMaxText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
        PlotXMinText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
        WarningText.font  = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;

        PlotYMaxText.color = TextColor;
        PlotYMinText.color = TextColor;
        PlotXMaxText.color = TextColor;
        PlotXMinText.color = TextColor;
        WarningText.color  = TextColor;

        PlotYMaxText.fontSize = FontSize;
        PlotYMinText.fontSize = FontSize;
        PlotXMaxText.fontSize = FontSize;
        PlotXMinText.fontSize = FontSize;
        WarningText.fontSize  = FontSize;

        //These might be nice to make them depend on TextureResolution
        PlotYMaxText.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.9f);
        PlotYMaxText.GetComponent <RectTransform>().anchorMax = new Vector2(0.1f, 1);
        PlotYMaxText.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
        PlotYMaxText.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
        PlotYMinText.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.1f);
        PlotYMinText.GetComponent <RectTransform>().anchorMax = new Vector2(0.1f, 0.2f);
        PlotYMinText.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
        PlotYMinText.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
        PlotXMaxText.GetComponent <RectTransform>().anchorMin = new Vector2(0.9f, 0);
        PlotXMaxText.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.1f);
        PlotXMaxText.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
        PlotXMaxText.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
        PlotXMinText.GetComponent <RectTransform>().anchorMin = new Vector2(0.08f, 0);
        PlotXMinText.GetComponent <RectTransform>().anchorMax = new Vector2(0.18f, 0.1f);
        PlotXMinText.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
        PlotXMinText.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
        WarningText.GetComponent <RectTransform>().anchorMin  = new Vector2(0, 0);
        WarningText.GetComponent <RectTransform>().anchorMax  = new Vector2(1, 1);
        WarningText.GetComponent <RectTransform>().offsetMin  = new Vector2(0, 0);
        WarningText.GetComponent <RectTransform>().offsetMax  = new Vector2(0, 0);
    }
Example #36
0
 // 5
 public void ShowNewWaveText()
 {
     StartCoroutine("hideNewWaveText");
     newWaveText.GetComponent <Text>().enabled = true;
 }
    void Update()
    {
        //subtract deltaTime until the timer runs out
        if (_timeLeft > 0 && eightBallDisplaying)
        {
            _timeLeft -= Time.deltaTime;
            Debug.Log(_timeLeft);
        }

        if (_timeLeft < 0 && eightBallDisplaying && !answerDisplayed)
        {
            Title.GetComponent <CanvasGroup>().alpha                      = 0;
            Prompt.GetComponent <CanvasGroup>().alpha                     = 0;
            Question.GetComponent <CanvasGroup>().alpha                   = 0;
            eightBall.GetComponent <SpriteRenderer>().enabled             = false;
            eightBallAnswerSprite.GetComponent <SpriteRenderer>().enabled = true;
            Cont.text = continueString;

            string response = "";
            int    randomResponseChoice;

            randomResponseChoice = Random.Range(0, 15);

            switch (randomResponseChoice)
            {
            case 1:
                response = "Yes, in due time.";

                break;

            case 2:
                response = "My sources say no.";
                break;

            case 3:
                response = "Definitely not.";
                break;

            case 4:
                response = "Yes.";
                break;

            case 5:
                response = "You will have to wait.";
                break;

            case 6:
                response = "I have my doubts.";
                break;

            case 7:
                response = "Outlook so so.";
                break;

            case 8:
                response = "Looks good to me!";
                break;

            case 9:
                response = "Who knows?";
                break;

            case 10:
                response = "Looking good!";
                break;

            case 11:
                response = "Probably.";
                break;

            case 12:
                response = "Are you kidding?";
                break;

            case 13:
                response = "Go for it!";
                break;

            case 14:
                response = "Don't bet on it.";
                break;

            case 15:
                response = "Forget about it.";
                break;
            }

            Answer.GetComponent <Text>().text = response;
            answerDisplayed = true;
        }

        if (eightBallDisplaying == true)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                //reset
                Title.GetComponent <CanvasGroup>().alpha    = 1;
                Prompt.GetComponent <CanvasGroup>().alpha   = 1;
                Question.GetComponent <CanvasGroup>().alpha = 1;
                Answer.GetComponent <Text>().text           = "";
                _timeLeft           = 2;
                eightBallDisplaying = false;
                answerDisplayed     = false;
                eightBall.GetComponent <SpriteRenderer>().enabled             = true;
                eightBallAnswerSprite.GetComponent <SpriteRenderer>().enabled = false;
                eightBall.GetComponent <Animator>().Play("EightBallIdle");
                Cont.text = "";
                eightBall.transform.position = oldPos;
            }
        }
    }
Example #38
0
    IEnumerator Start()
    {
        webViewObject = (new GameObject("WebViewObject")).AddComponent <WebViewObject>();
        webViewObject.Init(
            cb: (msg) =>
        {
            Debug.Log(string.Format("CallFromJS[{0}]", msg));
            status.text = msg;
            status.GetComponent <Animation>().Play();
        },
            err: (msg) =>
        {
            Debug.Log(string.Format("CallOnError[{0}]", msg));
            status.text = msg;
            status.GetComponent <Animation>().Play();
        },
            started: (msg) =>
        {
            Debug.Log(string.Format("CallOnStarted[{0}]", msg));
        },
            ld: (msg) =>
        {
            Debug.Log(string.Format("CallOnLoaded[{0}]", msg));
#if UNITY_EDITOR_OSX || !UNITY_ANDROID
            // NOTE: depending on the situation, you might prefer
            // the 'iframe' approach.
            // cf. https://github.com/gree/unity-webview/issues/189
#if true
            webViewObject.EvaluateJS(@"
                  if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
                    window.Unity = {
                      call: function(msg) {
                        window.webkit.messageHandlers.unityControl.postMessage(msg);
                      }
                    }
                  } else {
                    window.Unity = {
                      call: function(msg) {
                        window.location = 'unity:' + msg;
                      }
                    }
                  }
                ");
#else
            webViewObject.EvaluateJS(@"
                  if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
                    window.Unity = {
                      call: function(msg) {
                        window.webkit.messageHandlers.unityControl.postMessage(msg);
                      }
                    }
                  } else {
                    window.Unity = {
                      call: function(msg) {
                        var iframe = document.createElement('IFRAME');
                        iframe.setAttribute('src', 'unity:' + msg);
                        document.documentElement.appendChild(iframe);
                        iframe.parentNode.removeChild(iframe);
                        iframe = null;
                      }
                    }
                  }
                ");
#endif
#endif
            webViewObject.EvaluateJS(@"Unity.call('ua=' + navigator.userAgent)");
        },
            //ua: "custom user agent string",
            enableWKWebView: true);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
        webViewObject.bitmapRefreshCycle = 1;
#endif
        //webViewObject.SetAlertDialogEnabled(false);
        //webViewObject.SetURLPattern("", "^https://www.google.com");
        webViewObject.SetMargins(5, 100, 5, Screen.height / 4);
        webViewObject.SetVisibility(true);

#if !UNITY_WEBPLAYER && !UNITY_WEBGL
        if (Url.StartsWith("http"))
        {
            webViewObject.LoadURL(Url.Replace(" ", "%20"));
        }
        else
        {
            var exts = new string[] {
                ".jpg",
                ".js",
                ".html"  // should be last
            };
            foreach (var ext in exts)
            {
                var    url    = Url.Replace(".html", ext);
                var    src    = System.IO.Path.Combine(Application.streamingAssetsPath, url);
                var    dst    = System.IO.Path.Combine(Application.persistentDataPath, url);
                byte[] result = null;
                if (src.Contains("://"))    // for Android
                {
                    var www = new WWW(src);
                    yield return(www);

                    result = www.bytes;
                }
                else
                {
                    result = System.IO.File.ReadAllBytes(src);
                }
                System.IO.File.WriteAllBytes(dst, result);
                if (ext == ".html")
                {
                    webViewObject.LoadURL("file://" + dst.Replace(" ", "%20"));
                    break;
                }
            }
        }
#else
        if (Url.StartsWith("http"))
        {
            webViewObject.LoadURL(Url.Replace(" ", "%20"));
        }
        else
        {
            webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20"));
        }
        webViewObject.EvaluateJS(
            "parent.$(function() {" +
            "   window.Unity = {" +
            "       call:function(msg) {" +
            "           parent.unityWebView.sendMessage('WebViewObject', msg)" +
            "       }" +
            "   };" +
            "});");
#endif
        yield break;
    }
Example #39
0
 public void fukidashi()
 {
     text.GetComponent <Text>().text = SaveScript.getMessage();
 }
Example #40
0
    void Start()
    {
        state = new StandingState();
        attackState = new IdleAttackState();
        animator = GetComponent<Animator>();
        AttackCollider.SetActive(false);
        health = GetComponent<Health>();
        controller = GetComponent<MoveController>();
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2) / 3;
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        print("Gravity: " + gravity + "  Jump Velocity: " + jumpVelocity);

        initialRegenTime = 6;
        regenTick = 2;

        knockBackResistance = 10;
        knockBackCounter = 0;
        knockBackReset = 0;

        flinchResistance = 10;
        flinchCounter = 0;
        flinchReset = 0;

        text = GameObject.Find("HealthText").GetComponent<Text>();
        text.text = text.GetComponent<Score>().modX(0).ToString();
        blink = false;
        blinkTime = 0;
    }
Example #41
0
    // Use this for initialization
    void Start()
    {
        textoParpadea.GetComponent <Text>();

        StartCoroutine("Parpadear");
    }
Example #42
0
    public void RefreshUi(bool fromInspector = false)
    {
        if (fromInspector == false)
        {
            _width = _main.GameProperties.Width;
            _height = _main.GameProperties.Height;
        }

        UiUtils.ScreenWidth = (int)_width;
        UiUtils.ScreenHeight = (int)_height;

        _rightPoint = _width / 2.0f;
        _leftPoint = -_rightPoint;
        _topPoint = _height / 2.0f;
        _bottomPoint = -_topPoint;

        var x = 2;

        Transform[] allChildren = GetComponentsInChildren<Transform>(true);
        foreach (Transform child in allChildren)
        {
            switch (child.gameObject.name)
            {
                case "Canvas":
                    if (fromInspector == false)
                        _main.Canvas = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());
                    break;

                case "AdBanner":
                    if (fromInspector == false)
                        _main.AdBanner = child.gameObject;
                    UiUtils.SetFixedSize(UiUtils.XPercent(100), 50, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(50, 500, child.GetComponent<RectTransform>());
                    break;

                //---------------------------------------------------------------------------------
                case "Loading":
                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());
                    break;

                case "LoadingIcon":
                    UiUtils.SetSize(12, LayoutType.Square, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(87, 80, child.GetComponent<RectTransform>());
                    if (fromInspector == false)
                        _main.LoadingController.LoadingIcon = child.gameObject;
                    break;

                case "LoadingIconText":
                    if (fromInspector == false)
                        _main.LoadingController.LoadingIconText = child.GetComponent<Text>();
                    break;

                case "LoadingIconCircle":
                    child.GetComponent<Text>().text = UiUtils.circle;
                    UiUtils.SetIconSize(child.GetComponent<Text>());
                    if (fromInspector == false)
                        _main.LoadingController.LoadingIconCircle = child.GetComponent<Text>();
                    break;

                //---------------------------------------------------------------------------------
                case "DebugButton":
                    if (fromInspector == false)
                        _main.DebugButton = child.gameObject;
                    UiUtils.SetSize(5, LayoutType.Square, child.gameObject.GetComponent<RectTransform>());
                    UiUtils.SetPosition(5, 30, child.gameObject.GetComponent<RectTransform>());
                    break;

                case "DebugButtonText":
                    UiUtils.SetIconSize(child.GetComponent<Text>());
                    break;

                case "_DebugPanel":
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());
                    break;

                case "DebugContainer":
                    DebugContainer = child.gameObject;

                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(0, 0, child.gameObject.GetComponent<RectTransform>());

                    DebugContainer.transform.parent.gameObject.SetActive(false);
                    break;

                case "DebugText":
                    if (fromInspector == false)
                        _main.DebugTextGameObject = child.GetComponent<Text>();

                    UiUtils.SetSize(98, 98, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(2, 2, child.gameObject.GetComponent<RectTransform>());

                    break;

                case "DebugScrollImage":

                    UiUtils.SetSize(95, 80, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(3, 18, child.gameObject.GetComponent<RectTransform>());
                    break;

                case "DebugBackButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<Button>());
                    UiUtils.SetSize(27, 15, child.GetComponent<Button>());
                    UiUtils.SetPosition(15, 10, child.GetComponent<Button>());
                    break;

                //---------------------------------------------------------------------------------
                case "StartPanel":
                    StartPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<Image>());
                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());
                    break;

                case "PlayOfflineButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(27, 12, child.GetComponent<Button>());
                    UiUtils.SetPosition(30, 50, child.GetComponent<RectTransform>());
                    break;

                case "LoginButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(27, 12, child.GetComponent<Button>());
                    UiUtils.SetPosition(70, 50, child.GetComponent<RectTransform>());
                    break;

                //---------------------------------------------------------------------------------
                case "MainMenuPanel":
                    MainMenuPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(100, 80, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(0, 20, child.GetComponent<RectTransform>());
                    break;

                case "RedBallButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<Button>());
                    UiUtils.SetSize(27, 15, child.GetComponent<Button>());
                    UiUtils.SetPosition(50, 25, child.GetComponent<Button>());
                    break;

                case "RedBall":
                    UiUtils.SetAnchor(AnchorType.Center, child.GetComponent<Image>());
                    UiUtils.SetSize(LayoutType.Square, 69, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(0, 0, child.GetComponent<Image>());
                    break;

                //---------------------------------------------------------------------------------
                case "SettingsPanel":
                    SettingsPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(74, 80, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(13, 20, child.GetComponent<RectTransform>());
                    break;

                case "SettingsBackButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<Button>());
                    UiUtils.SetSize(27, 15, child.GetComponent<Button>());

                    UiUtils.SetPosition(14, 75, child.GetComponent<Button>());
                    //UiUtils.SetFixedPosition(UiUtils.GetPercent(child.parent.GetComponent<RectTransform>().sizeDelta.x, 14),
                    //    (_height - child.GetComponent<RectTransform>().sizeDelta.y) - 125,
                    //    child.GetComponent<RectTransform>());
                    break;

                //---------------------------------------------------------------------------------
                case "MapsPanel":
                    MapsPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<RectTransform>());
                    UiUtils.SetSize(74, 80, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(13, 20, child.GetComponent<RectTransform>());
                    break;

                case "MapsBackButton":
                    UiUtils.SetAnchor(AnchorType.LeftCenter, child.GetComponent<Button>());
                    UiUtils.SetSize(27, 15, child.GetComponent<Button>());

                    UiUtils.SetPosition(14, 75, child.GetComponent<Button>());
                    //UiUtils.SetFixedPosition(UiUtils.GetPercent(child.parent.GetComponent<RectTransform>().sizeDelta.x, 14),
                    //    (_height - child.GetComponent<RectTransform>().sizeDelta.y) - 125,
                    //    child.GetComponent<RectTransform>());
                    break;

                //---------------------------------------------------------------------------------
                case "TopBar":
                    TopBarPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.GetComponent<Image>());
                    UiUtils.SetSize(100, 20, child.GetComponent<Image>());
                    UiUtils.SetPosition(0, 0, child.GetComponent<Image>());
                    break;

                case "FacebookLoginButton":
                    FacebookLoginButton = child.GetComponent<Button>();
                    UiUtils.SetAnchor(AnchorType.TopLeft, FacebookLoginButton);
                    UiUtils.SetSize(20, 60, FacebookLoginButton);
                    UiUtils.SetPosition(2, 20, FacebookLoginButton);
                    break;

                case "ProfilePictureContainer":
                    UiUtils.SetSize(LayoutType.Square, 60, child.GetComponent<RectTransform>());
                    UiUtils.SetPosition(2, 20, child.GetComponent<Image>());
                    break;

                case "ProfilePicture":
                    ProfilePicture = child.GetComponent<Image>();
                    UiUtils.SetAnchor(AnchorType.TopLeft, ProfilePicture);
                    UiUtils.SetSize(87, 87, ProfilePicture);
                    UiUtils.SetPosition(7, 7, child.GetComponent<Image>());
                    break;

                case "ProfileName":
                    ProfileName = child.GetComponent<Text>();
                    UiUtils.SetSize(30, 60, ProfileName.GetComponent<RectTransform>());
                    UiUtils.SetPosition(10, 20, ProfileName.GetComponent<RectTransform>());
                    UiUtils.SetTextSize(child.GetComponent<Text>());
                    break;

                case "SettingsButton":
                    UiUtils.SetAnchor(AnchorType.TopRight, child.gameObject.GetComponent<RectTransform>());
                    UiUtils.SetSize(10, 60, child.gameObject.GetComponent<Button>());
                    UiUtils.SetPosition(98, 20, child.gameObject.GetComponent<RectTransform>());
                    break;

                case "SettingsButtonCog":
                    UiUtils.SetIconSize(child.GetComponent<Text>());
                    break;

                //---------------------------------------------------------------------------------
                case "GameViewPanel":
                    GameViewPanel = child.gameObject;
                    UiUtils.SetAnchor(AnchorType.TopLeft, child.gameObject.GetComponent<RectTransform>());
                    UiUtils.SetSize(LayoutType.Full, child.GetComponent<RectTransform>());

                    break;

                case "GameSettingsButton":
                    UiUtils.SetAnchor(AnchorType.TopRight, child.gameObject.GetComponent<RectTransform>());

                    UiUtils.SetFixedSize(UiUtils.XPercent(10),
                        UiUtils.GetPercent(TopBarPanel.GetComponent<RectTransform>().sizeDelta.y, 60),
                        child.gameObject.GetComponent<RectTransform>());

                    UiUtils.SetFixedPosition(UiUtils.XPercent(98),
                        UiUtils.GetPercent(TopBarPanel.GetComponent<RectTransform>().sizeDelta.y, 20),
                        child.gameObject.GetComponent<RectTransform>());
                    break;

                case "GameSettingsButtonText":
                    UiUtils.SetIconSize(child.GetComponent<Text>());
                    break;

                case "ReloadButton":
                    UiUtils.SetAnchor(AnchorType.TopRight, child.gameObject.GetComponent<RectTransform>());
                    UiUtils.SetFixedSize(UiUtils.XPercent(10),
                        UiUtils.GetPercent(TopBarPanel.GetComponent<RectTransform>().sizeDelta.y, 60),
                        child.gameObject.GetComponent<RectTransform>());
                    UiUtils.SetFixedPosition(UiUtils.XPercent(98),
                        UiUtils.GetPercent(TopBarPanel.GetComponent<RectTransform>().sizeDelta.y, 100),
                        child.gameObject.GetComponent<RectTransform>());
                    break;

                case "ReloadButtonText":
                    UiUtils.SetIconSize(child.GetComponent<Text>());
                    break;

                case "RightController":
                    _rightController = child.GetComponent<Button>();
                    UiUtils.SetSize(LayoutType.Square, 18.33333f, child.GetComponent<RectTransform>());
                    break;
                case "LeftController":
                    _leftController = child.GetComponent<Button>();
                    UiUtils.SetSize(LayoutType.Square, 18.33333f, child.GetComponent<RectTransform>());
                    break;
                case "UpController":
                    _upController = child.GetComponent<Button>();
                    UiUtils.SetSize(LayoutType.Square, 18.33333f, child.GetComponent<RectTransform>());
                    break;
                case "DownController":
                    _downController = child.GetComponent<Button>();
                    UiUtils.SetSize(LayoutType.Square, 18.33333f, child.GetComponent<RectTransform>());
                    break;
            }

            if (child.gameObject.name.Contains("ControllerSettings"))
            {
                UiUtils.SetSize(20, 20, child.GetComponent<RectTransform>());
                UiUtils.SetPosition(x, 20, child.GetComponent<RectTransform>());
                x = x + 25;
            }
        }

        if (fromInspector)
        {
            SetupController(true);

            int i;
            allChildren = MapsPanel.GetComponentsInChildren<Transform>();
            List<Transform> children = allChildren.ToList();
            for (i = 0; i < children.Count; i++)
            {
                if (!children[i].gameObject.name.Contains("Clone")) continue;

                DestroyImmediate(children[i].gameObject);
                children.RemoveAt(i);
            }

            var xPos = 8;
            var yPos = 17;

            for (i = 1; i <= 10; i++)
            {
                SetupMap(xPos, yPos, 0);
                xPos = xPos + 21;

                if (i % 5 != 0) continue;

                xPos = 8;
                yPos = yPos + 26;
            }
        }
    }
Example #43
0
    // Update is called once per frame
    void Update()
    {
        UpdateReservationPlayerNameText();

        switch (NowLacePhase)
        {
        case LacePhase.None:
            if (GoalPlyerNum <= 0 && IsLaceFlag == true)
            {
                //LaceUseVariableReset();
                MyPV.RPC("LaceUseVariableReset", PhotonTargets.AllBuffered);
            }
            break;

        case LacePhase.Ready:
            LaceReady();
            break;

        case LacePhase.Start:
            //カウントダウンが終わったら。
            if (Anim.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).normalizedTime > 1.0f)
            {
                //車のハンドブレーキを降ろす。
                UseLaceCar.GetComponent <SimpleCarController>().ChangeRunFlag();
                //レース開始。
                NowLacePhase = LacePhase.Game;

                //レースBGMを鳴らす
                SoundManager.Instance.PlayBGM(3);

                //カウントダウンテキストを非表示。
                CountDownTimeText.gameObject.SetActive(false);
                Anim.SetActive(false);

                //レース時間テキストを表示。
                LaceTimeText.gameObject.SetActive(true);
            }
            break;

        case LacePhase.Game:

            //プレイヤーが一人ゴールした。
            if (GoalPlyerNum == 1)
            {
                CountDownTimeText.gameObject.SetActive(true);

                //カウントダウン開始。
                CountDownTimeText.GetComponent <CountDownTime>().CountDownStart(CountDownTime, "00");

                NowLacePhase = LacePhase.Goal;
            }
            break;

        case LacePhase.Goal:
            //全員ゴールが出来た。
            if (GoalPlyerNum == LacePlayStartNum)
            {
                for (int i = 0; i < LacePlayerList.Count; i++)
                {
                    if (LacePlayerList[i].NetID == UseLaceCar.GetComponent <PhotonView>().ownerId)
                    {
                        UseLaceCar.transform.position = PodiumPos[i].position;
                        //カウントダウン開始。
                        CountDownTimeText.gameObject.SetActive(false);
                        NowLacePhase = LacePhase.Result;
                        SoundManager.Instance.PlaySE(2);
                    }
                }
                NowLacePhase = LacePhase.Result;
                return;
            }

            //カウントダウンが終了した時点で全員がゴールしていなくてもレースを終わらせる。
            if (CountDownTimeText.GetComponent <CountDownTime>().GetCountDownEnd() == true)
            {
                //カウントダウンを非表示。
                CountDownTimeText.gameObject.SetActive(false);

                //レースの順位分ループを回す。
                for (int j = 0; j < LacePlayerList.Count;)
                {
                    for (int i = 0; i < LacePlayerList.Count; i++)
                    {
                        if (LacePlayerList[i].NetID == PhotonNetwork.player.ID)
                        {
                            ////リザルトで表示する赤い帯の位置を設定。
                            //LaceResultTransparentPanel.GetComponent<RectTransform>().transform.position =
                            //    new Vector3(400.0f,
                            //    LaceResultTransparentPanel.GetComponent<RectTransform>().transform.position.y - 50.0f * j,
                            //    0.0f);

                            //ゴールしている時の処理。
                            if (LacePlayerList[i].isGoal == true)
                            {
                                UseLaceCar.transform.position = PodiumPos[j].position;
                            }
                            //ゴールしていない
                            else
                            {
                                //ゴールしていないプレイヤーのリザルト情報を設定。
                                MyPV.RPC("RPCAddLaceResult", PhotonTargets.All, UseLaceCar.GetComponent <PhotonView>().ownerId,
                                         "--:--:--", UseLaceCar.GetComponent <PhotonView>().owner.NickName, false);
                                UseLaceCar.GetComponent <SimpleCarController>().ChangeRunFlag();
                                NowLacePhase = LacePhase.Result;
                                return;
                            }
                        }
                    }
                    j++;
                }
            }
            break;

        case LacePhase.Result:
            //レース時間テキスト非表示。
            LaceTimeText.gameObject.SetActive(false);
            //リザルトを表示。
            LaceResultPanel.SetActive(true);
            //ミニマップを非表示。
            LaceMiniMap.SetActive(false);
            //lobbyに戻るボタンを表示。
            BackLobbyButton.gameObject.SetActive(true);
            break;

        case LacePhase.End:

            //レースに使うテキスト群を非表示。
            SetActiveCollection(false);

            //車を削除。
            if (UseLaceCar != null)
            {
                PhotonNetwork.Destroy(UseLaceCar);
                UseLaceCar = null;
            }

            //レース用のカメラから普通のカメラに戻す。
            MainCamera.GetComponent <NoboCamera>().enabled   = true;
            MainCamera.GetComponent <ExampleClass>().enabled = false;
            MainCamera.GetComponent <ExampleClass>().SetTarget(null);

            //lobbyに戻るボタンを非表示。
            BackLobbyButton.gameObject.SetActive(false);

            //レースフェーズを初期化。
            NowLacePhase = LacePhase.None;

            //PhotonNetwork上にプレイヤーを生成し、メインカメラのターゲットを切り替え。
            MainCamera.GetComponent <NoboCamera>().ChangeTarget(GameManager.GetComponent <GameManager>().PhotonInstantiatePlayer(ReturnLobbyPos.position, Quaternion.identity, 0).transform);
            break;

        default:
            break;
        }
    }
Example #44
0
    void Start()
    {
        this.Anserl   = Director.Anser;
        this.Anstimel = Director.Anstime;
        this.Ansl     = Director.point;
        this.keyl     = Director.key;
        this.result.Clear();
        //広告表示
        AdMob.bannerView.Show();

        //重複削除
        this.afterkey = this.keyl.Distinct();
        //設定時間外を削除


        Debug.Log("回答数:" + this.Anserl.Count);
        Debug.Log("タイム:" + this.Anstimel.Count);
        Debug.Log("問題数" + this.Ansl.Count);

        xcount = 0;
        y      = 0f;

        float sp = Maindirector.getSpan();

        foreach (int i in this.afterkey)
        {
            if (this.Anserl[i] == this.Ansl[i])
            {
                if (sp >= this.Anstimel[i])
                {
                    xcount += 1;
                    y      += this.Anstimel[i];
                }
            }
        }
        try
        {
            if (xcount == 0 || y == 0)
            {
                percent.GetComponent <Text>().text = xcount + " / " + this.Ansl.Count;
                Speed.GetComponent <Text>().text   = "False";
                assess.GetComponent <Text>().text  = "False";
                //書出し用へ格納
                this.day               = DateTime.Now;
                this.result["per"]     = 0;
                this.result["timeadv"] = 0;
                this.result["score"]   = 0;
            }
            else
            {
                per = ((float)xcount / this.Ansl.Count);
                Debug.Log("%:" + per + " xcount:" + xcount + " 回答数:" + this.Ansl.Count);
                timeadv   = y / xcount;
                ases      = 0;
                asespoint = 0;
                //y0.2以下なら100 y0.7以下50 y1.0以上10
                //× per
                if (timeadv <= 0.2)
                {
                    ases = (100 * per) / timeadv;
                }
                else if (timeadv > 0.2 && timeadv <= 1.0)
                {
                    ases = (50 * per) / timeadv;
                }
                else if (timeadv > 1.0 && timeadv <= 1.5)
                {
                    ases = (30 * per) / timeadv;
                }
                else if (timeadv > 1.5)
                {
                    ases = (10 * per) / timeadv;
                }
                asespoint = (int)(ases * 100);

                percent.GetComponent <Text>().text = xcount + " / " + this.Ansl.Count;
                Speed.GetComponent <Text>().text   = timeadv.ToString("F3");
                assess.GetComponent <Text>().text  = asespoint.ToString("F0");
                //書出し用へ格納
                this.day               = DateTime.Now;
                this.result["per"]     = this.per;
                this.result["timeadv"] = this.timeadv;
                this.result["score"]   = (float)this.asespoint;
            }
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }


        for (int i = 1; i < this.Ansl.Count + 1; i++)
        {
            Debug.Log("Anser_cycle:" + i + "/" + this.Ansl.Count + " 答え:" + this.Ansl[i]);
        }
    }
Example #45
0
    // Use this for initialization
    void Start()
    {
        Transform panel = transform.FindChild("Panel");

        _email = panel.FindChild("Email").GetComponent<InputField>();
        _password = panel.FindChild("Password").GetComponent<InputField>();
        _displayName = panel.FindChild("DisplayName").GetComponent<InputField>();

        _displayNameText = panel.FindChild("DisplayNameText").GetComponent<Text>();
        _status = panel.FindChild("Status").GetComponent<Text>();

        _btnSignIn = panel.FindChild("SignInButton").GetComponent<Button>();
        _btnCreate = panel.FindChild("CreateAccountButton").GetComponent<Button>();

        HideCreate(true);
        EnableControls(true);

        _status.GetComponent<CanvasGroup>().alpha = 0;

        _btnSignIn.onClick.AddListener(OnSignIn);
        _btnCreate.onClick.AddListener(OnCreate);
    }
    public void OnClick(BaseEventData evnt)
    {
        switch (InteractionMode)
                {
                case MapInteractionNormal:
                        InteractionMode=MapInteractionWriting;
                        UWHUD.instance.CursorIcon=UWHUD.instance.MapQuillWriting;

                        pos = Vector2.zero;
                        RectTransform rect = this.GetComponent<RectTransform>();
                        PointerEventData pntr = (PointerEventData)evnt;
                        CursorPos=UWHUD.instance.window.CursorPosition.center;//pntr.pressPosition;
                        RectTransformUtility.ScreenPointToLocalPointInRectangle(rect,pntr.pressPosition,pntr.pressEventCamera, out pos);
                        pos = pos + new Vector2 (150.0f, -4.0f);
                        GameObject myObj = (GameObject)Instantiate(Resources.Load("Prefabs/_MapNoteTemplate"));
                        mapNoteCurrent=myObj.GetComponent<Text>();
                        mapNoteCurrent.transform.parent=this.transform;
                        mapNoteCurrent.GetComponent<RectTransform>().anchoredPosition=pos;
                        myObj.GetComponent<RectTransform>().SetSiblingIndex(4);
                        MapNoteInput.textComponent= mapNoteCurrent;
                        MapNoteInput.text="";
                        MapNoteInput.Select();
                        break;

                case MapInteractionDelete:
                        InteractionMode=MapInteractionNormal;
                        UWHUD.instance.CursorIcon=UWHUD.instance.MapQuill;
                        break;
                case MapInteractionWriting:
                        OnNoteComplete();
                        break;
                }
    }
Example #47
0
    // Update is called once per frame
    void Update()
    {
        if (currentSelectedTurret != null)
        {
            turretName.GetComponent <Text> ().text     = currentSelectedTurret.GetComponent <turretUpgradeScript> ().turretName;
            turretImage.GetComponent <Image> ().sprite = currentSelectedTurret.GetComponent <turretUpgradeScript> ().turretImage;
            sellButton.transform.Find("sellText").GetComponent <Text> ().text = "Sell For: " + "$ " + Mathf.Round(.8f * currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost).ToString();

            GameObject localPlayer22 = GameObject.Find("localPlayer2");
            if (localPlayer22 != null)
            {
                localPlayer22.GetComponent <networkPlayerScript> ().hasKilled = true;
                // UPDATE KILLS AMOUNT
                killAmount.GetComponent <Text> ().text = "Alien Kills " + localPlayer22.GetComponent <networkPlayerScript> ().turretKills.ToString();
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentTargeting.CompareTo("first") == 0)
            {
                firstButton.GetComponent <upgradeButtonScript> ().activeButton = firstButton;
                lastButton.GetComponent <upgradeButtonScript> ().activeButton  = firstButton;
                stongButton.GetComponent <upgradeButtonScript> ().activeButton = firstButton;
                closeButton.GetComponent <upgradeButtonScript> ().activeButton = firstButton;

                currentButtonTarget = firstButton;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentTargeting.CompareTo("last") == 0)
            {
                firstButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;
                lastButton.GetComponent <upgradeButtonScript> ().activeButton  = lastButton;
                stongButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;
                closeButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;

                currentButtonTarget = lastButton;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentTargeting.CompareTo("strong") == 0)
            {
                firstButton.GetComponent <upgradeButtonScript> ().activeButton = stongButton;
                lastButton.GetComponent <upgradeButtonScript> ().activeButton  = stongButton;
                stongButton.GetComponent <upgradeButtonScript> ().activeButton = stongButton;
                closeButton.GetComponent <upgradeButtonScript> ().activeButton = stongButton;

                currentButtonTarget = closeButton;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentTargeting.CompareTo("close") == 0)
            {
                firstButton.GetComponent <upgradeButtonScript> ().activeButton = closeButton;
                lastButton.GetComponent <upgradeButtonScript> ().activeButton  = closeButton;
                stongButton.GetComponent <upgradeButtonScript> ().activeButton = closeButton;
                closeButton.GetComponent <upgradeButtonScript> ().activeButton = closeButton;

                currentButtonTarget = stongButton;
            }
            // SETTING COLOR OF UPGRADE BUTTONS IF MONEY IS NOT ENOUGH
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 0)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price)
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 1)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price)
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 2)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price)
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade1CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade1Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 3)
            {
                upgradeInfoName.GetComponent <Text> ().text       = "";
                upgradeInfoPrice.GetComponent <Text> ().text      = "MAXED OUT";
                upgradeInfoDescrption.GetComponent <Text> ().text = "";
                upgrade1Button.GetComponent <Image> ().color      = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
            }

            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 0)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price)
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 1)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price)
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 2)
            {
                if (GameManager.gameManager.GetComponent <GameManager> ().Resource < currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price)
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Cant Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(155f / 255f, 0f, 0f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                else
                {
                    upgrade2CanBuy.GetComponent <Text> ().text   = "Buy";
                    upgrade2Button.GetComponent <Image> ().color = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
                }
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 3)
            {
                upgradeInfoName.GetComponent <Text> ().text       = "";
                upgradeInfoPrice.GetComponent <Text> ().text      = "MAXED OUT";
                upgradeInfoDescrption.GetComponent <Text> ().text = "";
                upgrade2Button.GetComponent <Image> ().color      = new Color(94f / 255f, 41 / 255f, 117 / 255f, upgrade1Button.GetComponent <Image> ().color.a);
            }


            // INITIAL PRICE SET UP FOR UPGRADES
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 0)
            {
                //upgrade1Lvl1.GetComponent<Image> ().color = new Color (188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl2.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade1Lvl1.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade1Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade1Price.GetComponent <Text>().text   = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price.ToString();
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 1)
            {
                upgrade1Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price.ToString();
                //upgrade1Lvl2.GetComponent<Image> ().color = new Color (188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl2.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade1Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 2)
            {
                upgrade1Price.GetComponent <Text>().text   = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price.ToString();
                upgrade1Lvl2.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 3)
            {
                upgrade1Price.GetComponent <Text>().text   = "";
                upgrade1CanBuy.GetComponent <Text> ().text = "Maxed Out";
                upgrade1Lvl2.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade1Lvl3.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
            }

            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 0)
            {
                upgrade2Price.GetComponent <Text>().text   = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price.ToString();
                upgrade2Lvl2.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade2Lvl1.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade2Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 1)
            {
                upgrade2Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price.ToString();
                //upgrade2Lvl2.GetComponent<Image> ().color = new Color (188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl2.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                upgrade2Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
            }
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 2)
            {
                upgrade2Price.GetComponent <Text>().text   = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price.ToString();
                upgrade2Lvl2.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl3.GetComponent <Image> ().color = new Color(169f / 255f, 164f / 255f, 164f / 255f, 216f / 255f);
                //upgrade1Lvl3.GetComponent<Image> ().color = new Color (188f / 255f, 0f, 1f, 1f);
            }

            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 3)
            {
                upgrade2Price.GetComponent <Text>().text   = "";
                upgrade2CanBuy.GetComponent <Text> ().text = "Maxed Out";
                upgrade2Lvl2.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl1.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
                upgrade2Lvl3.GetComponent <Image> ().color = new Color(188f / 255f, 0f, 1f, 1f);
            }
        }
        GameObject localPlayer2;

        localPlayer2 = GameObject.Find("localPlayer2");
        if (firstPressed)
        {
            firstPressed = false;
            firstButton.GetComponent <upgradeButtonScript> ().activeButton     = firstButton;
            lastButton.GetComponent <upgradeButtonScript> ().activeButton      = firstButton;
            stongButton.GetComponent <upgradeButtonScript> ().activeButton     = firstButton;
            closeButton.GetComponent <upgradeButtonScript> ().activeButton     = firstButton;
            currentSelectedTurret.GetComponent <ShootScript> ().target         = "first";
            localPlayer2.GetComponent <networkPlayerScript>().currentTargeting = "first";
            localPlayer2.GetComponent <networkPlayerScript> ().updateTargeting = true;
            currentButtonTarget = firstButton;
            //currentButtonTarget.GetComponent<upgradeButtonScript> ().isActiveTarget = true;
        }
        if (lastPressed)
        {
            lastPressed = false;
            firstButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;
            lastButton.GetComponent <upgradeButtonScript> ().activeButton  = lastButton;
            stongButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;
            closeButton.GetComponent <upgradeButtonScript> ().activeButton = lastButton;

            currentSelectedTurret.GetComponent <ShootScript> ().target         = "last";
            localPlayer2.GetComponent <networkPlayerScript>().currentTargeting = "last";
            localPlayer2.GetComponent <networkPlayerScript> ().updateTargeting = true;

            currentButtonTarget = lastButton;
            //currentButtonTarget.GetComponent<upgradeButtonScript> ().isActiveTarget = true;
        }
        if (strongPressed)
        {
            strongPressed = false;
            stongButton.GetComponent <upgradeButtonScript> ().activeButton     = stongButton;
            lastButton.GetComponent <upgradeButtonScript> ().activeButton      = stongButton;
            stongButton.GetComponent <upgradeButtonScript> ().activeButton     = stongButton;
            closeButton.GetComponent <upgradeButtonScript> ().activeButton     = stongButton;
            currentSelectedTurret.GetComponent <ShootScript> ().target         = "strong";
            localPlayer2.GetComponent <networkPlayerScript>().currentTargeting = "strong";
            localPlayer2.GetComponent <networkPlayerScript> ().updateTargeting = true;
            currentButtonTarget = stongButton;
            //currentButtonTarget.GetComponent<upgradeButtonScript> ().isActiveTarget = true;
        }
        if (closePressed)
        {
            closePressed = false;
            firstButton.GetComponent <upgradeButtonScript> ().activeButton     = closeButton;
            lastButton.GetComponent <upgradeButtonScript> ().activeButton      = closeButton;
            stongButton.GetComponent <upgradeButtonScript> ().activeButton     = closeButton;
            closeButton.GetComponent <upgradeButtonScript> ().activeButton     = closeButton;
            currentSelectedTurret.GetComponent <ShootScript> ().target         = "close";
            localPlayer2.GetComponent <networkPlayerScript>().currentTargeting = "close";
            localPlayer2.GetComponent <networkPlayerScript> ().updateTargeting = true;
            currentButtonTarget = closeButton;
            //currentButtonTarget.GetComponent<upgradeButtonScript> ().isActiveTarget = true;
        }
        if (sellPressed)
        {
            GameManager.gameManager.GetComponent <GameManager> ().Resource += Mathf.Round(.8f * currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost);
            //currentSelectedTurret.GetComponent<ShootScript> ().enabled = false;
            //currentSelectedTurret.GetComponent<turretUpgradeScript> ().enabled = false;
            //currentSelectedTurret.GetComponent<turretShopSpawn> ().enabled = false;

            localPlayer2.GetComponent <networkPlayerScript> ().isSold = true;
            //Destroy (currentSelectedTurret);
            currentButtonTarget = null;
            sellButton.GetComponent <Outline> ().enabled = false;
            showShop    = false;
            sellPressed = false;
        }

        // UPDATES TURRET/RESOURCES IF UPGRADE IS PRESSED
        if (upgrade1Pressed)
        {
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 0 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1++;
                upgrade1Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price.ToString();
                GameManager.gameManager.GetComponent <GameManager>().Resource -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price;
                //currentSelectedTurret.GetComponent<ShootScript> ().damage = currentSelectedTurret.GetComponent<turretUpgradeScript> ().damage1;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Level  = 1;
                localPlayer2.GetComponent <networkPlayerScript> ().currentDamage = currentSelectedTurret.GetComponent <turretUpgradeScript> ().damage1;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Bought = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade1Price = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 1 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                upgrade1Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price.ToString();
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price;
                //currentSelectedTurret.GetComponent<ShootScript> ().damage = currentSelectedTurret.GetComponent<turretUpgradeScript> ().damage2;
                localPlayer2.GetComponent <networkPlayerScript> ().currentDamage = currentSelectedTurret.GetComponent <turretUpgradeScript> ().damage2;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1++;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Level  = 2;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Bought = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade1Price = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price;
                GameManager.gameManager.GetComponent <GameManager>().Resource   -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 2 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price;
                //currentSelectedTurret.GetComponent<ShootScript> ().damage = currentSelectedTurret.GetComponent<turretUpgradeScript> ().damage3;
                localPlayer2.GetComponent <networkPlayerScript> ().currentDamage = currentSelectedTurret.GetComponent <turretUpgradeScript> ().damage3;
                upgrade1Price.GetComponent <Text> ().text  = "";
                upgrade1CanBuy.GetComponent <Text> ().text = "MAXED OUT";
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Level  = 3;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade1Bought = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade1Price = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1++;
                GameManager.gameManager.GetComponent <GameManager>().Resource -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price;
            }
            upgrade1Pressed = false;
        }
        if (upgrade2Pressed)
        {
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 0 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                upgrade2Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price.ToString();
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price;
                //currentSelectedTurret.transform.Find("visionCollider").GetComponent<CircleCollider2D> ().radius = currentSelectedTurret.GetComponent<turretUpgradeScript> ().range1;
                localPlayer2.GetComponent <networkPlayerScript> ().currentRadius = currentSelectedTurret.GetComponent <turretUpgradeScript> ().range1;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2++;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Level  = 1;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Bought = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade2Price = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price;
                GameManager.gameManager.GetComponent <GameManager>().Resource   -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 1 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                upgrade2Price.GetComponent <Text>().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price.ToString();
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2++;
                GameManager.gameManager.GetComponent <GameManager>().Resource -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price;
                //currentSelectedTurret.transform.Find("visionCollider").GetComponent<CircleCollider2D> ().radius = currentSelectedTurret.GetComponent<turretUpgradeScript> ().range2;
                localPlayer2.GetComponent <networkPlayerScript> ().currentRadius = currentSelectedTurret.GetComponent <turretUpgradeScript> ().range2;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Level  = 2;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Bought = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade2Price = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 2 && currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price < GameManager.gameManager.GetComponent <GameManager>().Resource)
            {
                upgrade2Price.GetComponent <Text> ().text  = "";
                upgrade2CanBuy.GetComponent <Text> ().text = "MAXED OUT";
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Level              = 3;
                localPlayer2.GetComponent <networkPlayerScript> ().currentRadius             = currentSelectedTurret.GetComponent <turretUpgradeScript> ().range3;
                localPlayer2.GetComponent <networkPlayerScript>().upgrade2Bought             = true;
                localPlayer2.GetComponent <networkPlayerScript> ().upgrade2Price             = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().totalTurretCost += currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price;
                //currentSelectedTurret.transform.Find("visionCollider").GetComponent<CircleCollider2D> ().radius = currentSelectedTurret.GetComponent<turretUpgradeScript> ().range3;
                currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2++;
                GameManager.gameManager.GetComponent <GameManager>().Resource -= currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price;
            }
            upgrade2Pressed = false;
        }


        // UPDATING UPGRADE INFO
        if (upgrade1Hover)
        {
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 0)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl1Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 1)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl2Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 2)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade1Lvl3Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel1 == 3)
            {
                upgradeInfoName.GetComponent <Text> ().text       = "";
                upgradeInfoPrice.GetComponent <Text> ().text      = "";
                upgradeInfoDescrption.GetComponent <Text> ().text = "";
            }
            upgradeInfo.gameObject.SetActive(true);
            //upgrade1Hover = false;
        }

        if (upgrade2Hover)
        {
            if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 0)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl1Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 1)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl2Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 2)
            {
                upgradeInfoName.GetComponent <Text> ().text       = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Name;
                upgradeInfoPrice.GetComponent <Text> ().text      = "$ " + currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Price.ToString();
                upgradeInfoDescrption.GetComponent <Text> ().text = currentSelectedTurret.GetComponent <turretUpgradeScript> ().upgrade2Lvl3Description;
            }
            else if (currentSelectedTurret.GetComponent <turretUpgradeScript> ().currentUpgradeLevel2 == 3)
            {
                upgradeInfoName.GetComponent <Text> ().text       = "";
                upgradeInfoPrice.GetComponent <Text> ().text      = "";
                upgradeInfoDescrption.GetComponent <Text> ().text = "";
            }
            upgradeInfo.gameObject.SetActive(true);
        }

        if (!upgrade2Hover && !upgrade1Hover)
        {
            upgradeInfoName.GetComponent <Text> ().text       = "";
            upgradeInfoPrice.GetComponent <Text> ().text      = "";
            upgradeInfoDescrption.GetComponent <Text> ().text = "";
            upgradeInfo.gameObject.SetActive(false);
        }

        if (!showShop)
        {
            currentSelectedTurret = null;
            currentButtonTarget   = null;
            upgrade1Button.gameObject.SetActive(false);
            upgrade2Button.gameObject.SetActive(false);
            firstButton.gameObject.SetActive(false);
            lastButton.gameObject.SetActive(false);
            stongButton.gameObject.SetActive(false);
            closeButton.gameObject.SetActive(false);
            sellButton.gameObject.SetActive(false);
            upgradeInfo.enabled           = false;
            turretImage.enabled           = false;
            upgrade1.enabled              = false;
            upgrade2.enabled              = false;
            upgrade1Lvl1.enabled          = false;
            upgrade1Lvl2.enabled          = false;
            upgrade1Lvl3.enabled          = false;
            upgrade2Lvl1.enabled          = false;
            upgrade2Lvl2.enabled          = false;
            upgrade2Lvl3.enabled          = false;
            sellButton.enabled            = false;
            turretName.enabled            = false;
            killAmount.enabled            = false;
            upgrade1CanBuy.enabled        = false;
            upgrade1Price.enabled         = false;
            upgrade2CanBuy.enabled        = false;
            upgrade2Price.enabled         = false;
            upgradeInfoName.enabled       = false;
            upgradeInfoPrice.enabled      = false;
            upgradeInfoDescrption.enabled = false;
        }
        else
        {
            upgrade1Button.gameObject.SetActive(true);
            upgrade2Button.gameObject.SetActive(true);
            upgradeInfo.enabled = true;
            firstButton.gameObject.SetActive(true);
            lastButton.gameObject.SetActive(true);
            stongButton.gameObject.SetActive(true);
            closeButton.gameObject.SetActive(true);
            sellButton.gameObject.SetActive(true);
            upgradeInfo.enabled           = true;
            turretImage.enabled           = true;
            upgrade1.enabled              = true;
            upgrade2.enabled              = true;
            upgrade1Lvl1.enabled          = true;
            upgrade1Lvl2.enabled          = true;
            upgrade1Lvl3.enabled          = true;
            upgrade2Lvl1.enabled          = true;
            upgrade2Lvl2.enabled          = true;
            upgrade2Lvl3.enabled          = true;
            sellButton.enabled            = true;
            turretName.enabled            = true;
            killAmount.enabled            = true;
            upgrade1CanBuy.enabled        = true;
            upgrade1Price.enabled         = true;
            upgrade2CanBuy.enabled        = true;
            upgrade2Price.enabled         = true;
            upgradeInfoName.enabled       = true;
            upgradeInfoPrice.enabled      = true;
            upgradeInfoDescrption.enabled = true;
        }
    }
Example #48
0
    private IEnumerator PopText(Text text, int valueGainLevel)
    {
        float timeScalePop = 0;
        float delayPop = 0.15f;
        float popScale = 0;
        float initialScale = text.rectTransform.localScale.x;

        if (valueGainLevel > 0) {
            text.gameObject.SetActive (true);
            text.text = valueGainLevel.ToString ("+0");
        }

        text.GetComponent<AudioSource> ().Play ();

        while (timeScalePop < delayPop) {
            popScale = Mathf.Lerp (initialScale, initialScale * 4f, timeScalePop);
            text.rectTransform.localScale = new Vector2 (popScale, popScale);

            timeScalePop += TimeManager.deltaTime;
            yield return null;
        }

        text.rectTransform.localScale = new Vector2 (initialScale, initialScale);
    }
Example #49
0
 public void Start()
 {
     Now = 0;
     CounterText.GetComponent <Text>();
 }
Example #50
0
 void Start()
 {
     StartCoroutine(incremental());
     Animation clkAnim = clock.GetComponent <Animation>();
 }
Example #51
0
    IEnumerator Start()
    {
        webViewObject = (new GameObject("WebViewObject")).AddComponent <WebViewObject>();
        webViewObject.Init(
            cb: (msg) =>
        {
            Debug.Log(string.Format("CallFromJS[{0}]", msg));
            status.text = msg;
            status.GetComponent <Animation>().Play();
        },
            err: (msg) =>
        {
            Debug.Log(string.Format("CallOnError[{0}]", msg));
            status.text = msg;
            status.GetComponent <Animation>().Play();
        },
            started: (msg) =>
        {
            Debug.Log(string.Format("CallOnStarted[{0}]", msg));
        },
            hooked: (msg) =>
        {
            Debug.Log(string.Format("CallOnHooked[{0}]", msg));
        },
            ld: (msg) =>
        {
            Debug.Log(string.Format("CallOnLoaded[{0}]", msg));
#if UNITY_EDITOR_OSX || (!UNITY_ANDROID && !UNITY_WEBPLAYER && !UNITY_WEBGL)
            // NOTE: depending on the situation, you might prefer
            // the 'iframe' approach.
            // cf. https://github.com/gree/unity-webview/issues/189
#if true
            webViewObject.EvaluateJS(@"
                  if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
                    window.Unity = {
                      call: function(msg) {
                        window.webkit.messageHandlers.unityControl.postMessage(msg);
                      }
                    }
                  } else {
                    window.Unity = {
                      call: function(msg) {
                        window.location = 'unity:' + msg;
                      }
                    }
                  }
                ");
#else
            webViewObject.EvaluateJS(@"
                  if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
                    window.Unity = {
                      call: function(msg) {
                        window.webkit.messageHandlers.unityControl.postMessage(msg);
                      }
                    }
                  } else {
                    window.Unity = {
                      call: function(msg) {
                        var iframe = document.createElement('IFRAME');
                        iframe.setAttribute('src', 'unity:' + msg);
                        document.documentElement.appendChild(iframe);
                        iframe.parentNode.removeChild(iframe);
                        iframe = null;
                      }
                    }
                  }
                ");
#endif
#elif UNITY_WEBPLAYER || UNITY_WEBGL
            webViewObject.EvaluateJS(
                "window.Unity = {" +
                "   call:function(msg) {" +
                "       parent.unityWebView.sendMessage('WebViewObject', msg)" +
                "   }" +
                "};");
#endif
            webViewObject.EvaluateJS(@"Unity.call('ua=' + navigator.userAgent)");
        },
            //ua: "custom user agent string",
#if UNITY_EDITOR
            separated: false,
#endif
            enableWKWebView: true,
            wkContentMode: 0);  // 0: recommended, 1: mobile, 2: desktop
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
        webViewObject.bitmapRefreshCycle = 1;
#endif
        // cf. https://github.com/gree/unity-webview/pull/512
        // Added alertDialogEnabled flag to enable/disable alert/confirm/prompt dialogs. by KojiNakamaru · Pull Request #512 · gree/unity-webview
        //webViewObject.SetAlertDialogEnabled(false);

        // cf. https://github.com/gree/unity-webview/pull/550
        // introduced SetURLPattern(..., hookPattern). by KojiNakamaru · Pull Request #550 · gree/unity-webview
        //webViewObject.SetURLPattern("", "^https://.*youtube.com", "^https://.*google.com");

        // cf. https://github.com/gree/unity-webview/pull/570
        // Add BASIC authentication feature (Android and iOS with WKWebView only) by takeh1k0 · Pull Request #570 · gree/unity-webview
        //webViewObject.SetBasicAuthInfo("id", "password");

        webViewObject.SetMargins(5, 100, 5, Screen.height / 4);
        webViewObject.SetVisibility(true);

#if !UNITY_WEBPLAYER && !UNITY_WEBGL
        if (Url.StartsWith("http"))
        {
            webViewObject.LoadURL(Url.Replace(" ", "%20"));
        }
        else
        {
            var exts = new string[] {
                ".jpg",
                ".js",
                ".html"  // should be last
            };
            foreach (var ext in exts)
            {
                var    url    = Url.Replace(".html", ext);
                var    src    = System.IO.Path.Combine(Application.streamingAssetsPath, url);
                var    dst    = System.IO.Path.Combine(Application.persistentDataPath, url);
                byte[] result = null;
                if (src.Contains("://"))    // for Android
                {
#if UNITY_2018_4_OR_NEWER
                    // NOTE: a more complete code that utilizes UnityWebRequest can be found in https://github.com/gree/unity-webview/commit/2a07e82f760a8495aa3a77a23453f384869caba7#diff-4379160fa4c2a287f414c07eb10ee36d
                    var unityWebRequest = UnityWebRequest.Get(src);
                    yield return(unityWebRequest.SendWebRequest());

                    result = unityWebRequest.downloadHandler.data;
#else
                    var www = new WWW(src);
                    yield return(www);

                    result = www.bytes;
#endif
                }
                else
                {
                    result = System.IO.File.ReadAllBytes(src);
                }
                System.IO.File.WriteAllBytes(dst, result);
                if (ext == ".html")
                {
                    webViewObject.LoadURL("file://" + dst.Replace(" ", "%20"));
                    break;
                }
            }
        }
#else
        if (Url.StartsWith("http"))
        {
            webViewObject.LoadURL(Url.Replace(" ", "%20"));
        }
        else
        {
            webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20"));
        }
#endif
        yield break;
    }
 private void OnUiLoaded()
 {
     playerStatus = GameObject.FindGameObjectWithTag(Tags.PlayerStatus).GetComponent<Text>();
     instructionsLabel = GameObject.FindGameObjectWithTag(Tags.InstructionsLabel).GetComponent<Text>();
     fadeAwayComponent = instructionsLabel.GetComponent<FadeAway>();
 }
Example #53
0
    // Use this for initialization
    void Start()
    {
        LoadInformation.LoadAllInformation();

        pertanyaan1 = pertanyaan1.GetComponent <Canvas> ();
        pertanyaan2 = pertanyaan2.GetComponent <Canvas> ();
        pertanyaan3 = pertanyaan3.GetComponent <Canvas> ();
        pertanyaan4 = pertanyaan4.GetComponent <Canvas> ();
        pertanyaan5 = pertanyaan5.GetComponent <Canvas> ();
        pertanyaan6 = pertanyaan6.GetComponent <Canvas> ();
        pertanyaan7 = pertanyaan7.GetComponent <Canvas> ();
        pertanyaan8 = pertanyaan8.GetComponent <Canvas> ();
        pertanyaan9 = pertanyaan9.GetComponent <Canvas> ();

        no1 = no1.GetComponent <Button> ();
        no2 = no2.GetComponent <Button> ();
        no3 = no3.GetComponent <Button> ();
        no4 = no4.GetComponent <Button> ();
        no5 = no5.GetComponent <Button> ();
        no6 = no6.GetComponent <Button> ();
        no7 = no7.GetComponent <Button> ();
        no8 = no8.GetComponent <Button> ();
        no9 = no9.GetComponent <Button> ();

        exitfrom1 = exitfrom1.GetComponent <Button> ();
        exitfrom2 = exitfrom2.GetComponent <Button> ();
        exitfrom3 = exitfrom3.GetComponent <Button> ();
        exitfrom4 = exitfrom4.GetComponent <Button> ();
        exitfrom5 = exitfrom5.GetComponent <Button> ();
        exitfrom6 = exitfrom6.GetComponent <Button> ();
        exitfrom7 = exitfrom7.GetComponent <Button> ();
        exitfrom8 = exitfrom8.GetComponent <Button> ();
        exitfrom9 = exitfrom9.GetComponent <Button> ();

        backtoMap = backtoMap.GetComponent <Button> ();

        no1box = no1box.GetComponent <InputField> ();
        no2box = no2box.GetComponent <InputField> ();
        no3box = no3box.GetComponent <InputField> ();
        no4box = no4box.GetComponent <InputField> ();
        no5box = no5box.GetComponent <InputField> ();
        no6box = no6box.GetComponent <InputField> ();
        no7box = no7box.GetComponent <InputField> ();
        no8box = no8box.GetComponent <InputField> ();
        no9box = no9box.GetComponent <InputField> ();

        Checkno1 = Checkno1.GetComponent <Button> ();
        Checkno2 = Checkno2.GetComponent <Button> ();
        Checkno3 = Checkno3.GetComponent <Button> ();
        Checkno4 = Checkno4.GetComponent <Button> ();
        Checkno5 = Checkno5.GetComponent <Button> ();
        Checkno6 = Checkno6.GetComponent <Button> ();
        Checkno7 = Checkno7.GetComponent <Button> ();
        Checkno8 = Checkno8.GetComponent <Button> ();
        Checkno9 = Checkno9.GetComponent <Button> ();

        pertanyaan1.enabled = false;
        pertanyaan2.enabled = false;
        pertanyaan3.enabled = false;
        pertanyaan4.enabled = false;
        pertanyaan5.enabled = false;
        pertanyaan6.enabled = false;
        pertanyaan7.enabled = false;
        pertanyaan8.enabled = false;
        pertanyaan9.enabled = false;

        Level1Box            = Level1Box.GetComponent <InputField> ();
        CheckLevel1          = CheckLevel1.GetComponent <Button> ();
        AnswerAmpera         = AnswerAmpera.GetComponent <Text> ();
        AnswerAmpera.enabled = false;

        ScoreDisplay = ScoreDisplay.GetComponent <Text> ();
        score        = 100;

        if (buka1 == 1)
        {
            Destroy(GameObject.Find("no 1"));
        }
        if (buka2 == 1)
        {
            Destroy(GameObject.Find("no 2"));
        }
        if (buka3 == 1)
        {
            Destroy(GameObject.Find("no 3"));
        }
        if (buka4 == 1)
        {
            Destroy(GameObject.Find("no 4"));
        }
        if (buka5 == 1)
        {
            Destroy(GameObject.Find("no 5"));
        }
        if (buka6 == 1)
        {
            Destroy(GameObject.Find("no 6"));
        }
        if (buka7 == 1)
        {
            Destroy(GameObject.Find("no 7"));
        }
        if (buka8 == 1)
        {
            Destroy(GameObject.Find("no 8"));
        }
        if (buka9 == 1)
        {
            Destroy(GameObject.Find("no 9"));
        }
        if (selesai == 1)
        {
            Destroy(GameObject.Find("no 1"));
            Destroy(GameObject.Find("no 2"));
            Destroy(GameObject.Find("no 3"));
            Destroy(GameObject.Find("no 4"));
            Destroy(GameObject.Find("no 5"));
            Destroy(GameObject.Find("no 6"));
            Destroy(GameObject.Find("no 7"));
            Destroy(GameObject.Find("no 8"));
            Destroy(GameObject.Find("no 9"));
            Destroy(GameObject.Find("InputFieldLevel1"));
            Destroy(GameObject.Find("CheckLevel1"));
            AnswerAmpera.enabled = true;
            SetScore();
        }
    }
Example #54
0
    void Update()
    {
        //special cases to change stage
        if (stage <= 1 && isBoiling && heat > 0)
        {
            stage = 2;
        }
        if (stage == 2 && isBoiling && heat > 0)
        {
            nextStage();
        }
        if (stage >= 2 && stage <= 3 && isInside)
        {
            Destroy(circleIndicatorAni);                                       //on drag destroys circle PAN
        }
        if (stage == 3 && pattyCook.cookedness <= .52f)
        {
            nextStage();
        }
        if (stage == 4 && CuttingBoardController.isSwapped)
        {
            nextStage();
        }
        if (stage == 5)
        {
            Destroy(circleIndicatorAni);             //on drag destroys circle CB
        }
        if (stage == 6 && isBoiling && heat > 0)
        {
            nextStage();
        }
        if (stage >= 6 && stage <= 7 && isInside)
        {
            Destroy(circleIndicatorAni);                                       //on drag destroys circle PAN
        }
        if (stage == 7 && pattyCook.cookedness <= .52f)
        {
            nextStage();
        }
        if (stage == 8 && pattyCook.cookedness <= .3f)
        {
            nextStage();
        }
        if (stage == 9)
        {
            Destroy(circleIndicatorAni);             //on drag destroys circle CB
        }
        if (stage == 10 && heat == 4)
        {
            nextStage();
        }
        if (stage < 10 && heat == 4 && isChaosMode)
        {
            if (typedYet)
            {
                typedYet = false;
            }
            stage = 11;
        }

        switch (stage)
        {
        case 0:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                ttcButton.SetActive(true);
            }
            break;

        case 1:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                ttcButton.SetActive(true);
            }
            break;

        case 2:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                if (!isInside)
                {
                    circleIndicatorAni = Instantiate(circleIndicatorAnimation, panPosition, new Quaternion(0, 0, 0, 0));
                }
            }
            break;

        case 3:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                if (pattyCook.cookedness <= .52f)
                {
                    nextStage();
                }
            }
            break;

        case 4:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                circleIndicatorAni = Instantiate(circleIndicatorAnimation, cbPosition, new Quaternion(0, 0, 0, 0));
            }
            break;

        case 5:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                ttcButton.SetActive(true);
                Invoke("nextStage", 3.5f);
                addMoney(8);
            }
            break;

        case 6:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                circleIndicatorAni = Instantiate(circleIndicatorAnimation, panPosition, new Quaternion(0, 0, 0, 0));
            }
            break;

        case 7:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
            }
            break;

        case 8:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                isChaosMode        = true; //turns kitchen into a nightmare - Gordon. Im Nino!
                circleIndicatorAni = Instantiate(circleIndicatorAnimation, cbPosition, new Quaternion(0, 0, 0, 0));
            }
            break;

        case 9:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                Invoke("nextStage", 6f);
            }
            break;

        case 10:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
            }
            break;

        case 11:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                Invoke("nextStage", 6f);
                StartCoroutine(fadeOpacity());
            }
            break;

        case 12:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
                Invoke("nextStage", 6f);
            }
            break;

        case 13:
            if (!typedYet)
            {
                dialogueText.GetComponent <TypeWriterEffect>().typeText();
            }
            break;
        }
    }
Example #55
0
  public void run(int val) {
    int amount = Mathf.Abs(val);

    color = originalColor;
    // disappearStartPosX = originalX;
    // disappearStartPosY = originalY;
    show = true;
    text.text = changeDirection + amount.ToString();

    // disappearLengthX = Random.Range(0, baseDisappearLengthX);
    // disappearLengthY = Random.Range(baseDisappearLengthY * 0.8f, baseDisappearLengthY * 1.2f);

    // if (Random.Range(0, 100) < 50) {
    //   directionVariable = -1;
    // }

    float changeAmount = ((amount / changeBase) - 1) * changeScale;
    changeAmount = Mathf.Min(changeAmount, changeScale * maxScale);
    text.fontSize = originalFontSize + (int) changeAmount;

    if (hasIcon) {
      iconColor = originalIconColor;

      icon.transform.localScale = Vector3.one * (originalIconSize + changeAmount);
      icon.GetComponent<RectTransform>().anchoredPosition = new Vector3(-icon.transform.localScale.x, 0, 0);

      if (hasBonus) {
        plus = transform.Find("Plus").GetComponent<Text>();
        plus.fontSize = (int) (text.fontSize * 1.5f);

        plus.GetComponent<RectTransform>().anchoredPosition = new Vector3(-icon.transform.localScale.x * 1.5f - 5, 0, 0);
      }
    }
  }