// Use this for initialization void Start() { instance = this; newScaleX = GetComponent <Transform>().localScale.x * 2 / 3; newScaleY = GetComponent <Transform>().localScale.y * 2 / 3; GetComponent <Transform>().localScale = new Vector3(newScaleX, newScaleY, GetComponent <Transform>().localScale.z); }
public void AddStatus(BodyPart bodyPart) { GameObject statusGameObject = Instantiate(statusPrefab, statusPanel.transform); BodyPartStatus status = statusGameObject.GetComponent <BodyPartStatus>(); status.name = bodyPart.name; if (bodyPart is Organ) { status.partName.text = " " + bodyPart.name; } else { status.partName.text = bodyPart.name; } BloodBar bloodBar = status.bloodBar; OxygenBar oxygenBar = status.oxygenBar; HealthBar healthBar = status.healthBar; bloodBar.bodyPart = bodyPart; bloodBar.MinMax(); oxygenBar.bodyPart = bodyPart; oxygenBar.MinMax(); healthBar.bodyPart = bodyPart; healthBar.MinMax(); }
private openFlap flap; //!< to hold a reference to the flap script on the flaps /** * Use this for initialization */ void Start() { // find the oxygen bar oxygen = GameObject.Find("MouthGUI").GetComponent <OxygenBar>(); // get the script "openFlap" on the flaps flap = transform.parent.gameObject.GetComponent <openFlap>(); }
private void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); coll = GetComponent <Collider2D>(); oxygenTank = GetComponent <GameObject>(); PermanenttUI.perm.healthAmount.text = PermanenttUI.perm.health.ToString(); oxygenBar = GameObject.Find("oxygenBar").GetComponent <OxygenBar>(); }
void Awake() { if (instance == null) { instance = this; Init(100f); } else { //Destroy(this); } }
private void Awake() { if (!instance) { instance = this; } else if (instance != this) { Destroy(gameObject); } Transform oxygenContainer = transform.Find("OxygenFull"); conditionText = oxygenContainer.GetComponentInChildren <Text>(); conditionTextOutline = oxygenContainer.GetComponentInChildren <Outline>(); oxygenIndicator = oxygenContainer.GetComponent <Image>(); oxygenBackground = transform.Find("OxygenOut").GetComponent <Image>(); ultraCriticalOutline = transform.Find("UltraCriticalOutline").GetComponent <Image>(); ultraCriticalOutline.canvasRenderer.SetAlpha(0.0f); ultraCriticalOutline.gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { oxygenBar = GameObject.Find("oxygenBar").GetComponent <OxygenBar>(); }
private void OnDestroy() { Debug.Log("DestroyedGameBar"); instance = null; }
void Start() { player = GameObject.Find("Player").GetComponent <PlayerController>(); oxygenBar = GameObject.Find("OxygenBar").GetComponent <OxygenBar>(); positionOffset = transform.position; }
OxygenBar oxygenBar; //!< to hold a reference to the oxygen bar /** * Use this for initialization */ void Start() { oxygenBar = gameObject.GetComponent <OxygenBar> (); // find the reference to the oxygen bar }
void Awake() { Instance = this; }