protected void OnCollisionWithEnemy(GameObject enemy, float power)
    {
        power *= WeaponPowerMiltiplier;
        enemyTransform = enemy.transform;
        enemyController = enemy.GetComponent<FightEnemyController>();

        if (power < MinForceToHit)
            return;

        // Blood
        newBloodParticle = Instantiate<GameObject>(BloodParticles);
        newBloodParticle.transform.position = enemyTransform.position;
        newBloodParticle.transform.up = (enemyTransform.position - selfTransform.position).normalized;
        Destroy(newBloodParticle, 1);

        // Do damage
        enemyController.DoDamage(Mathf.Clamp(power, MinForceToHit, MaxForceToHit));
        //print(WeaponTypeName + ": " + hitVelocityMagnitude.ToString());

        // Damage Text
        newDamageText = Instantiate<GameObject>(DamageText);
        newDamageTextText = newDamageText.GetComponent<Text>();
        newDamageTextText.rectTransform.SetParent(WorldCanvas, false);
        newDamageTextText.rectTransform.position = enemyTransform.position + new Vector3(0f, 0.5f, 0f); ;
        newDamageTextText.text = string.Format("{0}", power.ToString("F0"));
    }
    // Use this for initialization
    void Start()
    {
        savior = GameObject.Find("Savior");
        toSave = GameObject.Find("ToSave");
        identifier = GameObject.Find("Speech2").GetComponentInChildren<IdentifierScript>();
        foreach (Text texto in GetComponentsInChildren<Text>())
        {

            Debug.Log("start");
            switch (texto.name)
            {
                case "SaviorLastText":
                    scriptSaviorLast = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
                    saviorLast = texto;
                    break;
                case "SaviorText1":
                    scriptSavior1 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
                    savior1 = texto;
                    break;
                case "SaviorText2":
                    scriptSavior2 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
                    savior2 = texto;
                    break;
                case "ToSaveText1":
                    scriptToSave1 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
                    toSave1 = texto;
                    break;
                case "ToSaveText2":
                    scriptToSave2 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
                    toSave2 = texto;
                    break;
            }
        }
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     textPanelText = DialogPanel.transform.GetChild(1).GetComponent<Text>();
     NPCTalkingTitle = DialogPanel.transform.GetChild(0).GetComponent<Text>();
     sizeOfTextPanels = textPanels.Length;
     PlayerPrefs.SetString("EnteringPlanet", "None");
 }
	void Start()
	{
		scoreLabelText = scoreLabel.GetComponent<Text>(); 
		score = 0;
		UpdateScore ();
		StartCoroutine(SpawnWaves ());
	}
 void Start()
 {
     HorizontalLayoutGroup hLayout = gameObject.AddComponent<HorizontalLayoutGroup> ();
     hLayout.padding = new RectOffset (5, 5, 0, 0);
     hLayout.childForceExpandHeight = false;
     hLayout.childForceExpandWidth = false;
     hLayout.transform.localScale = new Vector3 (1, 1, 1);
     //
     titleT = (new GameObject ()).AddComponent<Text> ();
     titleT.transform.SetParent(transform);
     titleT.name = "Title";
     titleT.color = color;
     titleT.font = DebugPanelViewport.arial;
     titleT.text = name;
     titleT.fontStyle = FontStyle.Bold;
     titleT.fontSize = 14;
     titleT.transform.localScale = new Vector3 (1, 1, 1);
     //
     LayoutElement lElement = titleT.gameObject.AddComponent<LayoutElement> ();
     lElement.minWidth = 100;
     //
     valueT = (new GameObject ()).AddComponent<Text> ();
     valueT.transform.SetParent(transform);
     valueT.name = "Value";
     valueT.color = color;
     valueT.fontSize = 14;
     valueT.font = DebugPanelViewport.arial;
     valueT.transform.localScale = new Vector3 (1, 1, 1);
 }
Example #6
0
    public void VerifFormule()
    {
        Jardin jardin = terrainHandler.getJardin();
        Communicate comm = new Communicate(SCRIPT_PYTHON, jardin);
        //lance le script
        comm.GetSource().Execute(comm.GetScope());
        for (int i = 1; i <= NB_FORMULE; i++)
        {
            iField = (InputField)GameObject.Find(PATH + "Form_" + i).GetComponent<InputField>();
            output = (Text)GameObject.Find(PATH + "VerifPan_" + i + "/verif_resultat_" + i).GetComponent<Text>();

            if (iField.text == "")
            {
                continue;
            }
            try
            {
                Formule formule = FormuleFactory.parse(iField.text);

                foreach (Element el in jardin.GetElements())
                {
                    Debug.Log(el);
                }

                object pythonForm = comm.HandleForm(formule);
                Func<Jardin, object> unity_my_interp_formul = comm.GetScope().GetVariable<Func<Jardin, object>>("unity_my_interp_formul");
                object pythonJardin = unity_my_interp_formul(jardin);
                Func<object, object, object> unity_eval_one_form = comm.GetScope().GetVariable<Func<object, object, object>>("unity_eval_one_form");
                var res = unity_eval_one_form(pythonJardin, pythonForm);

                //Affiche résultat
                if ((bool)res == true)
                {
                    output.color = Color.green;
                    output.text = "Vrai";
                }
                else
                {
                    output.color = Color.red;
                    output.text = "Faux";
                }
            }
            catch (ParserLogException)
            {
                output.color = Color.red;
                output.text = "Erreur";
                Debug.Log("Erreur formule");
            }
            catch (ValueErrorException)
            {
                output.color = new Color32(255, 128, 0, 255);
                output.text = "Var libre";
            }
            catch (Exception)
            {
                output.color = Color.red;
                output.text = "Erreur imprévue";
            }
        }
    }
 void OnInitEquippedWeapon(GameObject weapon)
 {
     textComponent      = gameObject.GetComponent<Text>();
     textComponent.text = weapon.GetComponent<Weapon>().title;
     textComponent.DOKill();
     FadeInInitialTitle();
 }
Example #8
0
 // Use this for initialization
 void Start ()
 {
     started = true;
     text = transform.GetChild (0).GetChild (0).GetComponent<Text> ();
     button = transform.GetChild (1);
     guid = Guid.NewGuid ();
 }
Example #9
0
    void EnemyAttack()
    {
        if (tw.ce.enemySummoned) {
            if (whoMoves == 1) {
                txt = damageTakenPlayer.GetComponent<Text>();
                dice = Random.Range(1, 21);
                diceDef = Random.Range(1, 5);
                if (dice > (tw.tst.dexTotal + diceDef)) {
                    dice = Random.Range(1, 5);
                    dmg = dice + tw.ce.enemySTR - (tw.tst.conTotal / 2);
                    sld = playerLife.GetComponent<Slider>();
                    sld.value -= dmg;
                    txt.text = dmg.ToString();
                    dmg = 0;
                    whoMoves = 0;
                } else {
                    txt.text = "MISS";
                    whoMoves = 0;
                }

                damageTakenEnemy.SetActive(false);
                damageTakenPlayer.SetActive(true);
            }
        }
    }
Example #10
0
	// Use this for initialization
	void Start () {
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();

		sysPrp.gameClearFlag = false;

		totalScoreBuff = 100;
		for (int i = 0; i < partySize; i++) {
			totalScoreBuff += partyMember[i].GetComponent<CharaPanel>().scoreBuff;
		}
		for (int i = 0; i < numOfType; i++) {
			totalPanelBuff [i] = 100;
			for (int j = 0; j < partySize; j++) {
				totalPanelBuff [i] += partyMember [j].GetComponent<CharaPanel> ().panelBuff [i];
			}
		}

		currentScore = 0;
		scoreText = scoreObj.GetComponent<Text> ();
		scoreText.text = currentScore.ToString ("###0");
		for (int i = 0; i < numOfType; i++) {
			currentPanelScore [i] = 0;
			panelScoreText[i] = panelScoreObj[i].GetComponent<Text>();
			panelScoreText[i].text = currentPanelScore[i].ToString("###0");
		}
		countdownObj.SetActive (true);
		countdownText = countdownObj.GetComponent<Text> ();
		timerText = timer.GetComponent<Text> ();
		timerText.text = timeLimit.ToString("#0.0");
		for(int i = 0; i < 2; i++){
			touchedPanel[i] = dummyPanel;
		}
		SetArray (0, 0, panel_Row - 1, panel_Column - 1);
		StartCoroutine("CountDown");
	}
Example #11
0
 void Start()
 {
     _debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>();
     _text = gameObject.GetComponent<Text>();
     _canvasGroup = gameObject.GetComponent<CanvasGroup> ();
     _baseAlpha = 1f;
 }
Example #12
0
	// Use this for initialization
	void Start () {
        CueLevels.dialog.SetActive(true);
        dialogTxt = CueLevels.dialog.GetComponentInChildren<Text>();
        dialogTxt.text = "Press Space to jump";
        Index = 1;
        if (CueLevels.retrying == true) { dialogTxt.text = "Jump and start!"; Index = 4; }
	}
Example #13
0
 static Events()
 {
     Text = new Text("", new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold)) { Color = System.Drawing.Color.ForestGreen };
     Orbwalker.OnPostAttack += OrbwalkerOnOnPostAttack;
     Obj_AI_Base.OnLevelUp += Obj_AI_Base_OnOnLevelUp;
     Drawing.OnDraw += OnDraw;
 }
Example #14
0
	// Use this for initialization
	void Awake () {
        im = GetComponent<Image>();
        txt = GetComponent<Text>();
        i = text_sequence.Length; // Starts paused

        sngl = this;
	}
 void Start()
 {
     upgradeText = gameObject.GetComponentInChildren<Text>();
     setButtonText();
     setInfoText();
     setSprite();
 }
	void Start ()
    {
        // 各アビリティボタンの親であるMaskをアタッチしているオブジェクトを取得
        attackParentGO = GameObject.Find("Tab_Action").transform.FindChild("Mask").gameObject;
        defenceParentGO = GameObject.Find("Tab_Support").transform.FindChild("Mask").gameObject;
        reactionParentGO = GameObject.Find("Tab_Reaction").transform.FindChild("Mask").gameObject;
        moveParentGO = GameObject.Find("Tab_Move").transform.FindChild("Mask").gameObject;

        // 初期化としてアタックタブをアクティブ化、それ以外のタブを非アクティブ化する
        attackParentGO.SetActive(true);
        defenceParentGO.SetActive(false);
        reactionParentGO.SetActive(false);
        moveParentGO.SetActive(false);

        // 非アクティブタブのテキスト文字色変更のためタブのテキストコンポを取得
        attackTabTextCompo = GameObject.Find("Tab_Action").transform.FindChild("Text").GetComponent<Text>();
        defenceTabTextCompo = GameObject.Find("Tab_Support").transform.FindChild("Text").GetComponent<Text>();
        reactionTabTextCompo = GameObject.Find("Tab_Reaction").transform.FindChild("Text").GetComponent<Text>();
        moveTabTextCompo = GameObject.Find("Tab_Move").transform.FindChild("Text").GetComponent<Text>();
        // 初期化としてアタックタブ以外を灰色にする
        attackTabTextCompo.color = new Color(255, 255, 255);
        defenceTabTextCompo.color = Color.grey;
        reactionTabTextCompo.color = Color.grey;
        moveTabTextCompo.color = Color.grey;

        // オーディオコンポを取得
        audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
        // TODO 本当はリクワイヤードコンポ属性を使うべき。上手く動いてくれなかったのでとりあえず
        if (null == audioCompo) audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
    }
	// Use this for initialization
	void Start () {
        counterText = GetComponent<Text>() as Text;
        set_seconds = maxSeconds;
        seconds = set_seconds;
        healthScript = healthObject.GetComponent<Health>();
		musicManager = canvas.GetComponent<MusicManager> ();
	}
    // Use this for initialization
    void Awake ()
    {
        if (!sceneController)
            sceneController = FindObjectOfType<SceneController>();

        if (!generationValueLabel)
            generationValueLabel = FindTextComponent("GenerationValue");

        if (!waveNoValueLabel)
            waveNoValueLabel = FindTextComponent("WaveNoValue");

        if (!spawnNoValueLabel)
            spawnNoValueLabel = FindTextComponent("SpawnNoValue");

        if (!highestFitnessValueLabel)
            highestFitnessValueLabel = FindTextComponent("HighestFitnessValue");

        if (!solutionsValueLabel)
            solutionsValueLabel = FindTextComponent("SolutionsValue");

        if (!remainingEnemiesValueLabel)
            remainingEnemiesValueLabel = FindTextComponent("RemainingEnemiesValue");

        if (!sceneStateValueLabel)
            sceneStateValueLabel = FindTextComponent("SceneStateValue");

        if (!autoEvolveToggle)
            autoEvolveToggle = GameObject.Find("AutoEvolveCheck").GetComponent<Toggle>();
        autoEvolveToggle.isOn = sceneController.AutoEvolve;
    }
Example #19
0
	// Use this for initialization
	void Start ()
	{
		counter = -1;
		text = GetComponent<Text>();
		text.text = "Mikey";
		
	}
	void OnInitInteger(int initInt)
	{
		textComponent      = gameObject.GetComponent<Text>();
		textComponent.text = legend + initInt.ToString();
		textComponent.DOKill();
		FadeInText();
	}
 public void Start()
 {
     textElement = GetComponent<Text>();
     unitTextElement = transform.Find("Unit").GetComponent<Text>();
     textElement.gameObject.SetActive(target != null);
     EventManager.Instance.AddListener<Event_PlayerTargetChanged>(OnPlayerTargetChanged);
 }
Example #22
0
 // Use this for initialization
 void Start()
 {
     inventoryTitle = transform.GetChild(0).GetComponent<Text>();
     backgroundInventory = GetComponent<Image>();
     backgroundSlot = transform.GetChild(1).GetChild(0).GetComponent<Image>();
     amountSlot = getTextAmountOfItem();
 }
Example #23
0
 // Use this for initialization
 void Start()
 {
     countdown = GameObject.Find("TrafficLight").GetComponent<Countdown>();
     countdownText = GetComponent<Text>();
     countdownText.text = "3";
     countdownText.fontSize = fontSize;
 }
Example #24
0
 void Start()
 {
     Application.runInBackground = true;
     client = new Client(PORT, "192.168.1.101");
     client.Work();
     sendMessage = forPrint;
 }
Example #25
0
 void Awake()
 {
     image = GetComponent<Image>();
     button = GetComponent<Button>();
     text = GetComponentInChildren<Text>();
     References.stateManager.changeState += onChangeState;
 }
    //Called when a level is loaded
	void OnLevelWasLoaded() {
        restartTimer = 0;
        totalMinutes = 0;
        playTimer = 0;
        GameOver = false;
        if (Application.loadedLevel == 1)
        {
            theSun = GameObject.Find("spotlight").GetComponent<Light>();
            mHero = GameObject.Find("Hero").GetComponent<Hero>();
            mTimer = GameObject.Find("Timer").GetComponent<Slider>();
            mHBar = GameObject.Find("hpBar").GetComponent<Slider>();
            mMin = GameObject.Find("minCounter").GetComponent<Text>();
            mSec = GameObject.Find("secCounter").GetComponent<Text>();
            Info = GameObject.Find("Info").GetComponent<Text>();
            mPanel = GameObject.Find("Panel").GetComponent<Image>();
            mPanel.gameObject.SetActive(false);
            Info.gameObject.SetActive(false);
            if(gameType == ENDLESS || gameType == DEBUG)
            {
                mTimer.gameObject.SetActive(false);
            }
            SpawnVariableControl();
            StartCoroutine(MasterSpawner(Troll));
        }
        else
        {
            SetButtons();
        }
	}
 void Awake()
 {
     Transform canvas = transform.Find("Canvas");
     Group = canvas.GetComponent<CanvasGroup>();
     Text = canvas.Find("Text").GetComponent<Text>();
     Rigidbody = GetComponent<Rigidbody2D>();
 }
Example #28
0
        /// <summary>
        /// Creates a new text dictionary based on a text file.
        /// </summary>
        /// <param name="textFile">The file to parse.</param>
        public TextDictionary(Text textFile)
        {
            dict = new Dictionary<string, Dictionary<string, string>>();
            for (int i = 0; i < textFile.Length; i++)
            {
                //clean string
                int pound = textFile[i].IndexOf('#');
                string s;
                if (pound >= 0)
                    s = textFile[i].Substring(0, pound).Replace(" ", "");
                else
                    s = textFile[i].Replace(" ", "");
                //get dot and equals locations
                int dot = s.IndexOf('.');
                int set = s.IndexOf('=');
                if (dot == -1 || set == -1 || set < dot)
                    continue;
                string first = s.Substring(0, dot);
                string second = s.Substring(dot + 1, set - dot - 1);
                string value = s.Substring(set + 1);
                if (!dict.ContainsKey(first))
                    dict[first] = new Dictionary<string, string>();
                dict[first][second] = value;
            }

            cachedString = null;
            cachedDict = null;
        }
Example #29
0
 void Awake()
 {
     text = GameObject.Find("Info").GetComponent<Text>();
     myCanvas = transform.parent.parent.parent.GetComponent<Canvas>();
     infoMessage = new List<string>();
     DisableMe();
 }
	void Start () {
		this.anim1 = this.conversante1.GetComponent<Animator> ();
		this.anim2 = this.conversante2.GetComponent<Animator> ();
		
		this.texto = GameObject.Find ("Dialogo").GetComponent<Text> ();
		
		TextAsset archivo = Resources.Load(this.fichero) as TextAsset;
		this.contenidoFichero = archivo.text;
		this.conversaciones = this.contenidoFichero.Split ('\n');
		this.numConver = 0;
		this.primeraConversacion = true;
		this.siguienteConversacion = false;
		
		this.audioActual = this.gameObject.GetComponent<AudioSource> ();
		//Inicializamos el clip del audio.
		this.audioActual.clip = this.audio1;

		//Registramos la informacion del Analytics
		if (Tracker.T () != null) {
			this.registrarTracker ();
		}

		if (this.fichero == "Transicion1")
			this.anim2.SetBool("contenta", false);
	}