protected override void OnInit() { TextureManager.Instance.Load("Images/exitButton", "Exit"); TextureManager.Instance.Load("Images/Cursor", "Cursor"); TextureManager.Instance.Load("Images/Body", "Body"); TextureManager.Instance.Load("Images/Face", "Face"); TextureManager.Instance.Load("Images/Head", "Head"); TextureManager.Instance.Load("Images/Arm", "Arm"); blueBlob = new Blob(Color.LightBlue, 0, new Vector2(-3f, -1f)); orangeBlob = new Blob(Color.Orange, 1, new Vector2(3f, -1f)); font = GameManager.Instance.Content.Load <SpriteFont>("Percentage"); exitButton = new Button(TextureManager.Instance.Get("Exit"), Vector2.Zero, () => { GameManager.Instance.LoadScene(new InitialScene()); }, ExitButtonScale); healthP2 = new HealthIndicator(font, new Vector2(256, GameManager.Instance.Height - 125), blueBlob, blueLivesLeft); healthP1 = new HealthIndicator(font, new Vector2(GameManager.Instance.Width - 448, GameManager.Instance.Height - 125), orangeBlob, orangeLivesLeft); ground = new Ground(); countdown = new Countdown(new Vector2(GameManager.Instance.Width * 0.5f, 256f), font, () => { blueBlob.InputEnabled = orangeBlob.InputEnabled = true; }, initialMessage, "3", "2", "1", "Go!"); Camera.Position += new Vector2(0f, -GameManager.Instance.GraphicsDevice.Viewport.Height * 0.5f); Camera.Scale = new Vector2(0.5f); World.Gravity = new Vector2(0f, 30f); World.ContactManager.BeginContact = BeginContact; }
// Use this for initialization void Start () { circles = GetComponentsInChildren<Circle>(); inputField = GameObject.Find("Canvas/InputField").GetComponent<InputField>(); stressBar = GameObject.Find("Canvas/Stress").GetComponent<Slider>(); audios = GetComponents<AudioSource>(); blackBackground = GameObject.Find("Canvas/BlackBackground"); gameOver = GameObject.Find("Canvas/BlackBackground/GameOver"); pressEnter = GameObject.Find("Canvas/BlackBackground/PressEnter"); gameStart = GameObject.Find("Canvas/BlackBackground/GameStart"); healthIndicator = GameObject.Find("Canvas/HealthIndicator").GetComponent<HealthIndicator>(); gameOver.SetActive(false); isGameOver = true; healthIndicator.SetTransparency(0f); currentDay = 0; taskIndex = 0; dayTimer = new Timer(30f); endOfDayTimer = new Timer(4f); dayTimer.Reset(); taskTimer = new Timer(StepTimeBasedOnDay); prevRandTask = 0; daysData = CSVParser.Parse("Data/days"); }
protected override void OnEnable() { base.OnEnable(); //healthHolder.HolderUpdated += OnHealthUpdate; indicator = ObjectPool.Instantiate <HealthIndicator> (); indicator.Initialize(Transform, 1.5f); }
// Use this for initialization void Start() { enemySpawner = FindObjectOfType <EnemySpawner>(); healthIndicator = FindObjectOfType <HealthIndicator>(); startMenu.SetActive(true); gameOverMenu.SetActive(false); healthIndicator.gameObject.SetActive(false); }
private void Start() { healthIndicator = FindObjectOfType <HealthIndicator>(); collider = GetComponent <BoxCollider2D>(); var player = GameObject.FindGameObjectWithTag("Player"); playerController = player.GetComponent <PlayerControl>(); playerFeetCollider = player.GetComponent <BoxCollider2D>(); playerCapsuleCollider = player.GetComponent <CapsuleCollider2D>(); }
private void Awake() { Instance = this; anims = GetComponentsInChildren <Animator>(); foreach (var sr in indicators) { sr.enabled = false; } }
// Start is called before the first frame update void Awake() { animator = GetComponentInChildren <Animator>(); state = State.Idle; originalPosition = transform.position; originalRotation = transform.rotation; health = GetComponent <Health>(); targetIndicator = GetComponentInChildren <TargetIndicator>(); healthIndicator = GetComponentInChildren <HealthIndicator>(); }
void Start() { leftMoveLimit = LeftWall.transform.position.x + (LeftWall.transform.localScale.x / 2); rightMoveLimit = RightWall.transform.position.x - (RightWall.transform.localScale.x / 2); score = ScoreInstance.GetComponent <Score>(); health = StartHealth; healthIndicator = HealthIndicatorInstance.GetComponent <HealthIndicator>(); healthIndicator.UpdateHealth(health); StartPlaying(); }
static int sortingOrder = 100; // It's order in the particular sortingLayer void Start () { health = startHealth; enemyMovement = GetComponent<Pathfinding>(); healthIndicator = GetComponentInChildren<HealthIndicator>(); ++WaveSpawner.enemiesAlive; healthIndicator.UpdateStatus((int)health, startHealth); // Update the values of the healthbar animator = GetComponent<Animator>(); isDead = false; speed = startSpeed; sr = GetComponentInChildren<SpriteRenderer>(); startColor = sr.color; sr.sortingOrder = sortingOrder; --sortingOrder; // Decrements the sorting order so that the next enemy to be spawned is gonna appear besides him }
public void UIToggleDisplayHealth() { StorageManager.data.optionInterfaceDisplayHealth = toggleDisplayHealth.value; GameObject player = GameObject.FindGameObjectWithTag("Player"); if (!player) { return; } HealthIndicator healthIndicator = player.GetComponentInChildren <HealthIndicator> (); if (healthIndicator) { healthIndicator.SetPosition(); } }
private string formatHealth(HealthIndicator health) { switch (health) { case Healthy: return("✓"); case TempError: return("⚠ Temp Errors"); case Concerning c: return("⚠ Slow " + c.Minutes + " / " + c.ExpectedMinutes + "m"); case PossiblyDead p: return("⚠ Dead? " + p.Minutes + " / " + p.ExpectedMinutes + "m"); case ConfirmedDead c: return("✗ Dead" + (c.Manual ? " (m)" : "")); default: throw new NotImplementedException("formatHealth (HealthIndicator " + Health + ")"); } }
private void Start() { healthIndicator = FindObjectOfType <HealthIndicator>(); }