void Start () { maStoreCam = GameObject.FindGameObjectWithTag ("MainCameraStore"); Destroy (maStoreCam); stScript = FindObjectOfType (typeof(StoreStuff)) as StoreStuff; money = 5; //money = System.Int32.Parse (stScript.moneyText.text); //Debug.Log ("Money is " + money); controller = GetComponent<PlayerController> (); gunController = GetComponent<GunController> (); moneyText = GameObject.FindGameObjectWithTag ("money"); mText = moneyText.GetComponent<Text> (); viewCamera = Camera.main; //swordButton = GameObject.Find ("swordButton"); startRot = transform.eulerAngles; sword = GameObject.FindGameObjectWithTag ("sword"); bow = GameObject.FindGameObjectWithTag ("bow"); sword.transform.localEulerAngles = new Vector3(0,90,50); sword.transform.position = GameObject.FindGameObjectWithTag("hold").transform.position; sword.transform.SetParent(this.transform); playerHealth = 3.0; hltScript = FindObjectOfType (typeof(Health2)) as Health2; incHealthScript = FindObjectOfType (typeof(IncreaseHealth)) as IncreaseHealth; Debug.Log ("tempHealth" + incHealthScript.temp); playerHealth = incHealthScript.temp; hltScript.takeHeart(); }
private void SetHealthIcons() { if (health == 3) { Health3.SetActive(true); Health2.SetActive(true); Health1.SetActive(true); } if (health == 2) { Health3.SetActive(false); Health2.SetActive(true); Health1.SetActive(true); } if (health == 1) { Health3.SetActive(false); Health2.SetActive(false); Health1.SetActive(true); } if (health == 0) { Health3.SetActive(false); Health2.SetActive(false); Health1.SetActive(false); } }
// Use this for initialization void Start() { anim = this.transform.GetComponent<Animator>(); myHealth2 = GetComponent<Health2>(); state = PlayerState.ALIVE; //potentially force a forever clamp on your animation if setting it in inspector is not working for you //animation["MOB1_M1_Stand_Relaxed_Death_B"].wrapMode = WrapMode.ClampForever; }
public void Shoot() { RaycastHit hit; if (Physics.Raycast(puntoOrigen.position, puntoOrigen.forward, out hit, lenght)) { Health2 health = hit.transform.GetComponent <Health2>(); if (health != null) { health.TakeDamage(damage); hit.rigidbody.AddForce((hit.transform.position - puntoOrigen.position).normalized * fuerza); } } }
void Awake() { myHealth2 = GetComponent<Health2>(); }
// Use this for initialization void Start() { myHealth2 = GetComponent<Health2>(); drowndamage = Random.Range (5, 20); }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); _Health_ = GameObject.FindObjectOfType <Health2>(); }
/* Health2 is the class that dictates the logic behind the health bar functioning. It is a singleton pattern ans thus was made into its own class. * The TopLayerImage is the image of the top layer of the health bar. The portion of the health bar that is filled and unfilled according to the * change in the players health. * The data type Image is a standard Unity type. * */ private void Awake() { TopLayerImage = transform.Find("TopLayer").GetComponent <Image>(); health = new Health2(); }
// Use this for initialization void Start() { myHealth = player2.GetComponent<Health2>(); burndamage = Random.Range (5, 20); }