void Awake() { // Setting up references. groundCheck = transform.Find("groundCheck"); landCheck = transform.Find("landCheck"); gameManager = GameObject.FindGameObjectsWithTag("GameController")[0].GetComponent <GameManager>(); animator = GetComponent <Animator>(); spriteRenderer = GetComponent <SpriteRenderer>(); dustParticles = transform.Find("DustParticles").GetComponent <ParticleSystem>(); livesCounter = GameObject.FindGameObjectsWithTag("LivesCounter")[0].GetComponent <LivesCounter>(); //Setting initial values continuousJump = false; extraJump = extraJumpAmount; hp = 10; isAlive = true; canBeHit = true; timeHovered = 0f; startedHovering = false; animator.Play("RoombaIdle"); animator.SetBool("Hover", false); animator.SetBool("Jump", false); defaultColor = spriteRenderer.color; }
/// <summary> /// Called when the player is instantiated (before Start). Handles player initialization. /// </summary> public override void Awake() { base.Awake(); TagFilter = "Enemy|Laser"; // Retrieve references field = LevelController.Singleton.Field; collider2d = GetComponent <Collider2D>(); rigidbody2d = GetComponent <Rigidbody2D>(); hitEffect = GetComponentInChildren <ParticleSystem>(); // Initializes the renderers target = new Vector2(transform.position.x, transform.position.y); GameObject targetObject = (GameObject)Instantiate(targetPrefab, Vector3.zero, Quaternion.identity); targetRenderer = targetObject.GetComponent <SpriteRenderer>(); dashRenderer = targetObject.GetComponent <LineRenderer>(); dashRenderer.sortingOrder = -1; dashRenderer.material = new Material(Shader.Find("Particles/Additive")); dashRenderer.SetColors(dashStartInactive, dashEndInactive); // Retrieves counter references foreach (GameObject counter in GameObject.FindGameObjectsWithTag("Counter")) { if (counter.GetComponent <LivesCounter>() != null) { livesCounter = counter.GetComponent <LivesCounter>(); } if (counter.GetComponent <DashCounter>() != null) { dashCounter = counter.GetComponent <DashCounter>(); } } }
void Awake() { coinCounter = GameObject.FindGameObjectWithTag("TextCoinsCount").GetComponent <CoinCounter> (); liveCounter = GameObject.FindGameObjectWithTag("TextLiveCount").GetComponent <LivesCounter> (); coins = GameObject.FindGameObjectsWithTag("Coin"); totalCoins = coins.Length; }
public PlayerDeathHandler( PlayerModel playerModel, LivesCounter livesCounter, PlayerAnimationStates playerAnimationStates) { _playerModel = playerModel; _livesCounter = livesCounter; _playerAnimationStates = playerAnimationStates; }
// Use this for initialization void Start() { ballSFX = GetComponent <AudioSource> (); rb = GetComponent <Rigidbody2D> (); scoreText = GameObject.FindGameObjectWithTag("scoreText").GetComponent <ScoreCounter> (); livesText = GameObject.FindGameObjectWithTag("livesText").GetComponent <LivesCounter> (); launched = false; wallBounce = false; paddleBounce = false; }
// void Start() { //Finds the gameobject "Music" and save it has "backMusic" backMusic = GameObject.Find("Music"); //Finds the gameobject "hitAudio" and save it has "hitaudio" hitaudio = GameObject.Find("hitAudio"); // birdLife = GameObject.Find("Bird1"); checkLife = birdLife.GetComponent <LivesCounter>(); dead = checkLife.dead; }
public LevelController( PlayerFacade playerFacade, //PowerBarFacade powerBarFacade, LivesCounter livesCounter, DynamitesCounter dynamitesCounter ) { _playerFacade = playerFacade; //_powerBar = powerBarFacade; _livesCounter = livesCounter; _dynamitesCounter = dynamitesCounter; }
public void Init() { EventManager = EventManager.InstancePublic; TowerShop = new TowerShop(this) { Price = 400 }; MoneyCounter = new MoneyCounter(this, 1000); LivesCounter = new LivesCounter(this, 100); //temp, parse var tempList = new List <TowerInfo>() { new TowerInfo("tower_1_square", 500, 650), new TowerInfo("tower_2_square", 900, 1100), new TowerInfo("tower_3_square", 0, 1500) }; TowerMenu = new TowerMenu(this, tempList); }
private void Start() { scoreCounter = FindObjectOfType <ScoreCounter>(); livesCounter = FindObjectOfType <LivesCounter>(); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectsWithTag("Player")[0].GetComponent <PlayerController>(); livesCounter = GameObject.FindGameObjectsWithTag("LivesCounter")[0].GetComponent <LivesCounter>(); }
public void Restart() { StartCoroutine("RestartCo"); LivesCounter.UpdateLives(); }
protected override void Awake() { base.Awake(); _livesCounter = GetComponentInChildren <LivesCounter>(); _boostCounter = GetComponentInChildren <BoostCounter>(); }