Esempio n. 1
0
 /// <summary>
 /// Gets scripts and components.
 /// </summary>
 private void Start()
 {
     _lives = GetComponent <Lives>();
     sord   = Instantiate(sord, transform.position, transform.rotation);
     sord.SetActive(false);
     _sordScript = sord.GetComponent <SwordScript>();
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     rigid     = GetComponent <Rigidbody2D>();
     script    = FindObjectOfType <Lives>();
     MaxHealth = health;
     baseSpeed = speed;
 }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     health   = GetComponent <Lives>();
     gameOver = GameObject.FindGameObjectWithTag("GameOverPanel");
     //game over canvas is visible now
     gameOverCanvas = gameOver.GetComponent <Canvas>();
 }
    void OnTriggerEnter2D(Collider2D collider)
    {
        livesScript = FindObjectOfType<Lives>();

        Destroy (collider.gameObject);
        livesScript.LoseLives();
    }
Esempio n. 5
0
 void Start()
 {
     playerHealth = player.GetComponent <Health>();
     loadScene    = GetComponent <LoadScene>();
     playerLives  = GetComponent <Lives>();
     bonfires     = GetComponent <ResetLocations>();
 }
    // Start is called before the first frame update
    void Start()
    {
        //get a reference to the currency script attached to the manager
        GameObject manager = GameObject.Find("Manager");

        Debug.Log("is manager null? " + manager.ToString());
        currency = manager.GetComponent <Currency>();
        Debug.Log("is currency script null? " + currency.ToString());

        health = manager.GetComponent <Lives>();

        //first time playing through
        if (!PlayerPrefs.HasKey("started"))
        {
            gameStartCanvas.SetActive(true);
            Time.timeScale = 0f;
        }
        else
        {
            gameStartCanvas.SetActive(false);
        }


        gameOverCanvas.SetActive(false);

        //set starting lives and currency
        health.lives   = startingLives;
        currency.money = startingCurrency;
    }
Esempio n. 7
0
 void Start()
 {
     PaddletoBallVector = transform.position - paddle1.transform.position;
     myAudio            = GetComponent <AudioSource>();
     ballLaunch         = GetComponent <Rigidbody2D>();
     lives = FindObjectOfType <Lives>();
 }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        life = this;
        lifeCount = startingLives;

        lifeText = GetComponent<Text> ();
    }
Esempio n. 9
0
 private void Start()
 {
     gameLevel      = FindObjectOfType <GameLevel>();
     lives          = FindObjectOfType <Lives>();
     ball           = FindObjectOfType <Ball>();
     scoreText.text = score.ToString();
 }
Esempio n. 10
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        //Detect collision of the player character with an enemy character, or with an enemy bullet
        if (((col.tag == "EnemyCharacterTag") || (col.tag == "EnemyBulletTag")) && !isImmune)
        {
            //Reset score multiplier on damaged
            ScoreMultiplier = 1;

            StartCoroutine("FlashCharacterOnDamage"); //Blink unit on damaged
            PlayExplosion();                          //Create damaged or explosion effect
            Lives--;                                  //player lose one Lives

            LiveUIText.text = Lives.ToString();       //Update the UI text Lives

            if (Lives <= 0)                           //If player is dead
            {
                StopAllCoroutines();
                //Change game manager state to game over state
                GameManagerGO.GetComponent <GameManager>().SetGameManagerState(GameManager.GameManagerState.GameOver);

                //hide the player's character
                gameObject.SetActive(false);
            }
        }
    }
Esempio n. 11
0
    public void UpdateMyEnemyLivesText()
    {
        Lives myEnemyLives = myEnemy.GetComponent <Lives> ();

        myEnemyLives.livesText = myEnemyLivesText;
        myEnemyLives.updateText();
    }
 void Start()
 {
     anim                      = GetComponent <Animator>();
     lives                     = GetComponent <Lives>();
     lives.OnLostLife         += PlayDestroyedAnimation;
     GameController.OnRespawn += PlayIdleAnimation;
 }
Esempio n. 13
0
 void Start()
 {
     //Get Components
     rig    = GetComponent <Rigidbody2D>();
     source = GetComponent <AudioSource>();
     lives  = GameObject.FindGameObjectWithTag("Collectibles").GetComponent <Lives>();
 }
Esempio n. 14
0
 void Start()
 {
     aSource            = GetComponent <AudioSource>();
     pLives             = GetComponent <Lives>();
     pShooting          = GetComponent <PlayerShooting>();
     pLives.OnLostLife += PlayShipDestroyed;
     pShooting.OnShoot += PlayShot;
 }
Esempio n. 15
0
    void Awake()
    {
        instance = this;

        text = GetComponent <Text>();

        text.text = lives.ToString();
    }
 void Start()
 {
     staticRef = this;
     if (infiniteLives)
     {
         InfiniteMark();
     }
 }
Esempio n. 17
0
 private void Awake()
 {
     Cockpit     = GameObject.Find("Cockpit");
     Hit         = gameObject.GetComponent <AudioSource>();
     l           = GetComponent <Lives>();
     hitEffect   = hitEffectObject.GetComponent <ParticleSystem>();
     deathEffect = deathEffectObject.GetComponent <ParticleSystem>();
 }
Esempio n. 18
0
 public OwnerProfile()
 {
     userProfile     = new UserProfile();
     facebookProfile = new FacebookProfile();
     lives           = new Lives();
     level_data      = new LevelData();
     inbox           = new Inbox();
 }
Esempio n. 19
0
 private void OnHeroDefeat()
 {
     Lives.ChangeValue(-1);
     if (Lives.value > Lives.minValue)
     {
         onRespawn.Invoke(Hero);
     }
 }
Esempio n. 20
0
 // Start is called before the first frame update
 void Start()
 {
     playerPU = FindObjectOfType <PlayerPowerUps>();
     lives    = FindObjectOfType <Lives>();
     FindObjectOfType <LevelManager>().enabled = false;
     SetUpMoveBoundaries();
     PlayerPrefs.SetInt("LastScene", SceneManager.GetActiveScene().buildIndex);
 }
Esempio n. 21
0
    private void Start()
    {
        addScore = new AddScore();

        sceneControl = GameObject.FindObjectOfType <SceneControl>();
        lives        = GameObject.FindObjectOfType <Lives>();
        balls        = GameObject.FindObjectsOfType <Ball>();
        score        = GameObject.FindObjectOfType <Score>();
    }
Esempio n. 22
0
 // Use this for initialization
 void Start()
 {
     IsGrounded  = true;
     rb2d        = GetComponent <Rigidbody2D>();
     a2d         = GetComponent <Animator>();
     sprite      = GetComponent <SpriteRenderer>();
     continues   = GameObject.Find("AppManager").GetComponent <ContinueScript>();
     lifeCounter = GameObject.Find("LiveHolder").GetComponent <Lives>();
 }
Esempio n. 23
0
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (vulnerable && other != null && other.CompareTag("Enemy"))
     {
         vulnerable = false;
         Lives.LoseLife(invincibilityTime * 0.33f);
         StartCoroutine(Invincible());
     }
 }
Esempio n. 24
0
 void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Destroy(gameObject);
         Lives.HurtPlayer(pointsToDead);
         print("Red_Destroy");
     }
 }
Esempio n. 25
0
        public override void Update(GameTime gameTime, InputHelper inputHelper)
        {
            Text  = "Score: " + Score.ToString() + "\n\n";
            Text += "Lives: " + Lives.ToString();



            base.Update(gameTime, inputHelper);
        }
Esempio n. 26
0
    // Update is called once per frame
    void Update()
    {
        scoreDisplay.text = "" + score.ToString();

        if (score < 0)
        {
            Lives.Die();
        }
    }
Esempio n. 27
0
    private void Awake()
    {
        if (instance)
        {
            Destroy(instance);
        }

        instance = this;
    }
Esempio n. 28
0
 // Start is called before the first frame update
 void Start()
 {
     rigidBody   = GetComponent <Rigidbody2D>();
     boxCollider = GetComponent <BoxCollider2D>();
     gunScript   = gun.GetComponent <Gun>();
     livesScript = FindObjectOfType <Lives>();
     animator    = GetComponent <Animator>();
     hitSound    = GetComponent <AudioSource>();
 }
Esempio n. 29
0
 private void Revive()
 {
     Lives.SetValue(Lives.Value - 1);
     IsDead = false;
     ClearBags();
     m_animator.SetBool("is_dead", value: false);
     m_animator.SetInteger("death_type", 1);
     GameLogic.OnPenguinRevive();
 }
Esempio n. 30
0
 public override void Awake()
 {
     base.Awake();
     if (lives == null)
     {
         lives = this;
     }
     Name = "Lives";
 }
Esempio n. 31
0
 // Start is called before the first frame update
 void Start()
 {
     lives     = Controller.GetComponent <Lives>();
     FireTimer = 0;
     cam       = Camera.main;
     height    = 2f * cam.orthographicSize;
     width     = height * cam.aspect;
     GetComponent <SpriteRenderer>().color = Color.blue;
 }
Esempio n. 32
0
        public void CallMove()
        {
            var Lives2 = Lives.ToList();

            foreach (var life in Lives2)
            {
                life.Move();
            }
        }
Esempio n. 33
0
		public void Start ()
		{

		p=GetComponent<Player_Movement>();
            rig=GetComponent<Rigidbody2D>();
				camTrack = camera.GetComponent<Camera_Tracker> ();
				blocks = new List<GameObject> ();
				graves = new List<GameObject> ();
				heartsList = GameObject.Find ("LifeCounter").GetComponent<Lives> ();
				pillsList = GameObject.Find ("PillCounter").GetComponent<Lives> ();
		}
Esempio n. 34
0
    void Start()
    {
        lifescript = gameObject.AddComponent<Lives>();
        //gameoverpanel.Init();
        ms = gameObject.AddComponent<ModeSelect>();

        if (ms.getMode() == 1)
        {
            mc = FindObjectOfType<Mechanic>();
        }

        if (ms.getMode() == 2)
        {
            gmc = FindObjectOfType<GrannyMechanic>();
        }

        charanimator = FindObjectOfType<CollisionPlayer>().gameObject.GetComponentInChildren<Animator>();
        sfxm = FindObjectOfType<SFXManager>().GetComponent<SFXManager>();
        audiom = FindObjectOfType<AudioRegulator>().gameObject;
        lives = 3;
        realTime = 0f;
        slowdown = false;
        badtrip = false;
        activeSlow = false;
        activeTrip = false;
    }
Esempio n. 35
0
 //private GameObject audioCollect;
 //private bool playGame;
 //    private bool instructions;
 //    Vector3 PlayerPos;//PlayerPos
 //    Vector3 lastPlayerPos;//PlayerPos
 //    public float playerSpeed_normal;//playerSpeed
 // Use this for initialization
 void Start()
 {
     //lastPlayerPos = transform.position;
     //yield return StartCoroutine (Shoots ());
     //audioCollect = GameObject.Find ("SFX");
     lifeScript = theLives.GetComponent<Lives> ();
     lifeScriptShadow = theLivesShadow.GetComponent<Lives> ();
     shootAnim = GetComponent<Animator> ();
     //instructions = true;
     //playGame = false;
 }
Esempio n. 36
0
 void Start()
 {
     ms = gameObject.AddComponent<ModeSelect>();
     lifescript = gameObject.AddComponent<Lives>();
     life1.sprite = lifesprite;
     life2.sprite = lifesprite;
     life3.sprite = lifesprite;
     previouslifes = lifescript.returnLives();
     gameover = false;
 }
Esempio n. 37
0
		void Start ()
		{
				hearts = GameObject.Find ("LifeCounter").GetComponent<Lives> ();
				pills = GameObject.Find ("PillCounter").GetComponent<Lives> ();
				p = GetComponent<Player_Movement> ();
		}
Esempio n. 38
0
 // Use this for initialization
 void Start()
 {
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     isMobile = Application.isMobilePlatform;
     lives = (Lives)GameObject.FindGameObjectWithTag ("Lives").GetComponent<Lives>();
     score = (Score)GameObject.FindGameObjectWithTag ("Score").GetComponent<Score> ();
     cameraFollower = (CameraFollower)GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraFollower> ();
     Restart ();
     dot_count = GameObject.FindGameObjectsWithTag ("Dot").Length;
 }