//MORTE void kill() { GameObject HP; Count_life life; HP = GameObject.FindWithTag("HP"); if (wasborn != null) { wasborn = Instantiate(wasborn, wasborn.transform.position, wasborn.transform.rotation) as GameObject; life = HP.GetComponent <Count_life> (); life.life_hit(); } else { } Destroy(this.gameObject, 0.05f); //GAME OVER }
private void OnMouseDown() { Destroy(C); if (C.GetComponent <Renderer>().material.color == Color.red) { GameObject Score; Score = GameObject.Find("Score"); string s = Score.GetComponent <TextMesh>().text; s = s.Substring(s.IndexOf(" "), s.Length - s.IndexOf(" ")); int a = int.Parse(s); a++; Score.GetComponent <TextMesh>().text = "Score: " + a; } if (C.GetComponent <Renderer>().material.color == Color.blue) { GameObject HP; HP = GameObject.Find("HP"); string s = HP.GetComponent <TextMesh>().text; s = s.Substring(s.IndexOf(" "), s.Length - s.IndexOf(" ")); int b = int.Parse(s); b--; HP.GetComponent <TextMesh>().text = "HP: " + b; if (b == 0) { HP.GetComponent <TextMesh>().text = "YOU LOSE!!!"; LoseLevel(); } } }
public void SetEnemyUpperPos() { Position = new Vector3(113.9f, 150, 10); this.GetComponent <Text>().alignment = TextAnchor.MiddleRight; Armor.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); HP.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); Fire.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); }
public void SetPlayerPos() { Position = new Vector3(-113.9f, 37.1f, 10); this.GetComponent <Text>().alignment = TextAnchor.MiddleLeft; Armor.GetComponent <RectTransform>().localPosition = new Vector3(-105, 0, 0); HP.GetComponent <RectTransform>().localPosition = new Vector3(-105, 0, 0); Fire.GetComponent <RectTransform>().localPosition = new Vector3(-105, 0, 0); }
public void SetCentralUpperPos() { Position = new Vector3(-100, 250, 10); this.GetComponent <Text>().alignment = TextAnchor.MiddleRight; Armor.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); HP.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); Fire.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); Coin.GetComponent <RectTransform>().localPosition = new Vector3(105, 0, 0); }
void Awake() { playerStats = playerObject.GetComponent <Stats>(); playerHP = playerHP.GetComponent <HP>(); playerScore = playerScore.GetComponent <Score>(); animator = GetComponent <Animator>(); rigidBody = GetComponent <Rigidbody2D>(); sound = soundManager.GetComponent <SoundManager>(); }
private void DisableHiddenPathTrigger() { GameObject[] HiddenPath = GameObject.FindGameObjectsWithTag("HiddenPathTrigger"); foreach (GameObject HP in HiddenPath) { HiddenPathTrigger hiddenPath = HP.GetComponent <HiddenPathTrigger> (); if (hiddenPath.isShowing) { hiddenPath.mesh.enabled = true; } } }
void UpdateStrength() { StrField.GetComponent <Text> ().text = Str + ""; this.Att_Dmg = 4 * Str + 1 * Dex; this.Att_DmgCrit = 2 * Str; this.Att_HP = 2 * Str + 5 * Con; this.Att_Weight = 2 * Str + 1 * Con; Dmg.GetComponent <Text> ().text = Att_Dmg + ""; DmgCrit.GetComponent <Text> ().text = Att_DmgCrit + ""; Weight.GetComponent <Text> ().text = Att_Weight + ""; HP.GetComponent <Text> ().text = Att_HP + ""; }
void Start() { journeyLength = 0; objani = GetComponent <Animator>(); InvokeRepeating("GettingHungry", 2f, 3f); InvokeRepeating("GettingDirty", 2f, 3f); InvokeRepeating("GettingOld", 2f, 5f); InvokeRepeating("HealthRegen", 2f, 8f); health_bar = HP.GetComponent <Text>(); cleaniness_bar = c.GetComponent <Text>(); hunger_bar = h.GetComponent <Text>(); xp_bar = xp.GetComponent <Text>(); age_bar = AGE.GetComponent <Text>(); _event = Event.GetComponent <Text>(); strength_bar = Strenght.GetComponent <Text>(); }
void UpdateConstituition() { ConField.GetComponent <Text> ().text = Con + ""; this.Att_Weight = 2 * Str + 1 * Con; this.Att_HP = 2 * Str + 5 * Con; this.Att_Armor = 1 * Con; this.Att_FireRes = 1 * Con + 1 * Int; this.Att_IceRes = 1 * Con + 1 * Int; this.Att_LightRes = 1 * Con + 1 * Int; Weight.GetComponent <Text> ().text = Att_Weight + ""; HP.GetComponent <Text> ().text = Att_HP + ""; Armor.GetComponent <Text> ().text = Att_Armor + ""; FireRes.GetComponent <Text> ().text = Att_FireRes + ""; IceRes.GetComponent <Text> ().text = Att_IceRes + ""; LightRes.GetComponent <Text> ().text = Att_LightRes + ""; }
void Delete() { GameObject HP; HP = GameObject.Find("HP"); string s = HP.GetComponent <TextMesh>().text; if (s != "YOU LOSE!!!") { if (C.GetComponent <Renderer>().material.color == Color.red) { s = s.Substring(s.IndexOf(" "), s.Length - s.IndexOf(" ")); int b = int.Parse(s); b--; HP.GetComponent <TextMesh>().text = "HP: " + b; if (b == 0) { HP.GetComponent <TextMesh>().text = "YOU LOSE!!!"; LoseLevel(); } } } }
// Use this for initialization void Start() { float width = Screen.width; float height = Screen.height; float W_height = 10; float W_width = width / height * W_height; Vector2 max_vec = new Vector2(width, height); select.GetComponent <RectTransform>().localPosition = max_vec; select.GetComponent <RectTransform>().sizeDelta = max_vec; back_home.GetComponent <RectTransform>().localPosition = new Vector3(-0.34f * width, -0.46f * height, 0); back_home.GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.06f * height); stage3.GetComponent <RectTransform>().localPosition = new Vector3(0.12f * width, 0.3f * height, 0); stage3.GetComponent <RectTransform>().sizeDelta = new Vector2(0.5f * width, 0.35f * height); stage2.GetComponent <RectTransform>().localPosition = new Vector3(-0.2f * width, 0.05f * height, 0); stage2.GetComponent <RectTransform>().sizeDelta = new Vector2(0.48f * width, 0.3f * height); stage1.GetComponent <RectTransform>().localPosition = new Vector3(0.2f * width, -0.13f * height, 0); stage1.GetComponent <RectTransform>().sizeDelta = new Vector2(0.48f * width, 0.2f * height); stage0.GetComponent <RectTransform>().localPosition = new Vector3(-0.2f * width, -0.28f * height, 0); stage0.GetComponent <RectTransform>().sizeDelta = new Vector2(0.35f * width, 0.13f * height); detail.GetComponent <RectTransform>().localPosition = max_vec; detail.GetComponent <RectTransform>().sizeDelta = max_vec; Big.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.1f * height, 0); Big.GetComponent <RectTransform>().sizeDelta = new Vector2(0.95f * width, 1.3f * width); Dtitle.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.4f * height, 0); Dtitle.GetComponent <RectTransform>().sizeDelta = new Vector2(0.95f * width, 0.2f * width); text.GetComponent <RectTransform>().localPosition = new Vector3(0, -0.28f * height, 0); text.GetComponent <RectTransform>().sizeDelta = new Vector2(0.9f * width, 0.25f * height); Title.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.451f * height, 0); Title.GetComponent <RectTransform>().sizeDelta = new Vector2(width, 0.11f * height); Menu.GetComponent <RectTransform>().localPosition = new Vector3(0, -0.44f * height, 0); Menu.GetComponent <RectTransform>().sizeDelta = new Vector2(width, 0.12f * height); BG.GetComponent <RectTransform>().sizeDelta = new Vector2(5f * width, height); BG.GetComponent <RectTransform>().localPosition = new Vector2(2f * width, 0); HP.GetComponent <RectTransform>().sizeDelta = new Vector2(0.6f * width, 0.1f * height); HP.GetComponent <RectTransform>().localPosition = new Vector3(0.2f * width, 0.12f * height); home_img.GetComponent <RectTransform>().sizeDelta = new Vector2(1.3f * width, 1.05f * height); home_img.GetComponent <RectTransform>().localPosition = new Vector2(-2.1f * width, -0.1f * height); Ready.sizeDelta = new Vector2(0.34f * width, 0.2f * height); Ready.localPosition = new Vector3(0.3f * width, -0.26f * height); GameObject.Find("Hikousen").GetComponent <RectTransform>().sizeDelta = new Vector2(0.2f * width, 0.1f * height); for (int n = 0; n < 12; n++) { int i = Mathf.FloorToInt(n / 4f); int j = Mathf.RoundToInt(n % 4f); box_Chara[n].GetComponent <RectTransform>().sizeDelta = new Vector2(0.25f * width, 0.15f * height); box_Chara[n].GetComponent <RectTransform>().localPosition = new Vector3((-0.375f + j * 0.25f) * width, (0.02f - 0.15f * i) * height); texts[n].GetComponent <RectTransform>().sizeDelta = new Vector2(0.23f * width, 0.14f * height); //texts[n].GetComponent<RectTransform>().localPosition = new Vector3(0, - 0.1f * height); } party_Chara[0].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[0].GetComponent <RectTransform>().localPosition = new Vector3(0.33f * width, 0.26f * height); party_Chara[1].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[1].GetComponent <RectTransform>().localPosition = new Vector3(0, 0.26f * height); party_Chara[2].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[2].GetComponent <RectTransform>().localPosition = new Vector3(-0.33f * width, 0.26f * height); Ptext[0].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Ptext[1].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Ptext[2].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Destroy(this.gameObject, 1f); /*PlayerPrefs.SetInt("Box_ID" + 1, 3); * PlayerPrefs.SetInt("Box_ID" + 2, 2); * PlayerPrefs.SetInt("Box_ID" + 3, 4); * PlayerPrefs.SetInt("Box_ID" + 4, 3); * PlayerPrefs.SetInt("Box_ID" + 5, 2);*/ }