Exemplo n.º 1
0
 public void Awake()
 {
     livesScript      = FindObjectOfType <PlayerLives>();
     scoreScript      = FindObjectOfType <Score>();
     processingScript = FindObjectOfType <PostProcesssorController>();
     timerScriprt     = FindObjectOfType <TimerCreation>();
 }
Exemplo n.º 2
0
    private BombsUI m_Bomb;                  //Bombs

    void Start()
    {
        m_Spawner     = GameObject.FindGameObjectWithTag("PowerUp").GetComponent <PowerUpSpawner> ();
        m_BulletSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBulletSpawn> ();
        m_lives       = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <PlayerLives> ();
        m_Bomb        = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <BombsUI> ();
    }
Exemplo n.º 3
0
        private void Start()
        {
            _player        = GameObject.Find("Player");
            _playerLives   = _player.GetComponent <PlayerLives>();
            _playerManager = _player.GetComponent <PlayerManager>();

            _panels = new List <CanvasGroup> {
                mainPanel, fadePanel, chestPanel, pausePanel, deathPanel
            };
            if (PlayerPrefs.GetInt("init") == 1)
            {
                foreach (var panel in _panels)
                {
                    if (panel.name == mainPanel.name)
                    {
                        continue;
                    }
                    panel.DOFade(0, .5f);
                    StartCoroutine(WaitSetActive(panel.gameObject, .5f, false));
                }
            }
            else
            {
                FirstFadeIn();
            }
        }
	private BombsUI m_Bomb; //Bombs

	void Start()
	{
		m_Spawner = GameObject.FindGameObjectWithTag("PowerUp").GetComponent<PowerUpSpawner> ();
		m_BulletSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBulletSpawn> (); 
		m_lives = GameObject.FindGameObjectWithTag ("UI").GetComponentInChildren<PlayerLives> ();
		m_Bomb = GameObject.FindGameObjectWithTag ("UI").GetComponentInChildren<BombsUI> ();
	}
Exemplo n.º 5
0
//private int lives;
    void  Awake()
    {
        //enabled = false;
        if (damagePrefab)
        {
            if (damageEffectTransform == null)
            {
                damageEffectTransform = transform;
            }
            GameObject effect = Spawner.Spawn(damagePrefab, Vector3.zero, Quaternion.identity);
            effect.transform.parent        = damageEffectTransform;
            effect.transform.localPosition = Vector3.zero;
            damageEffect = effect.GetComponent <ParticleEmitter>();
            Vector2 tempSize = new Vector2(GetComponent <Collider>().bounds.extents.x, GetComponent <Collider>().bounds.extents.z);
            colliderRadiusHeuristic   = tempSize.magnitude * 0.5f;
            damageEffectCenterYOffset = GetComponent <Collider>().bounds.extents.y;
        }
        if (scorchMarkPrefab)
        {
            scorchMark = GameObject.Instantiate(scorchMarkPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            scorchMark.SetActive(false);
        }
        sceneFadeInOut = GameObject.FindGameObjectWithTag(DoneTags.fader).GetComponent <DoneSceneFadeInOut>();
        gameTheme1     = GameObject.FindGameObjectWithTag("AlarmSound").GetComponent <AudioSource>();
        Debug.Log(gameTheme1.name);
        gameTheme2       = GameObject.FindGameObjectWithTag("GameController").GetComponent <AudioSource>();
        sirenGameObjects = GameObject.FindGameObjectsWithTag(DoneTags.siren);

        // if (gameTheme != null) Debug.Log("music found");

        scoreController = GameObject.FindGameObjectWithTag("Player").GetComponent <SpawnAtCheckpoint>();
        checkLives      = false;
        playerLives     = GameObject.FindGameObjectWithTag("PlayerLives").GetComponent <PlayerLives>();
        //  lives = playerLives.lives;
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (!player_lives)
        {
            player_lives = GameObject.FindObjectOfType <PlayerLives>();
        }

        if (player_lives.player_seen_level())
        {
            player.enabled = true;
            Destroy(GameObject.Find("player_dialog_img"));
            Destroy(gameObject);
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (!current.get_next_text())
            {
                player.enabled = true;
                player_lives.mark_level_seen();
                Destroy(GameObject.Find("player_dialog_img"));
                Destroy(gameObject);
            }
            else
            {
                current = GameObject.FindObjectOfType <TextBox_Text>();
            }
        }
    }
Exemplo n.º 7
0
 private void Start()
 {
     // Here we are setting our Prefab to find GameObject of Type LevelManager - To find the script with this name.
     levelManager = GameObject.FindObjectOfType <LevelManager>();
     ball         = GameObject.FindObjectOfType <Ball>();
     lives        = GameObject.FindObjectOfType <PlayerLives>();
 }
 public void TestHealthStartsAtThreePlayer2()
 {
     PlayerLives playerLives = new PlayerLives ();
     int expectedHealth = 3;
     int actualHealth = playerLives.currentHealth2;
     Assert.AreEqual (expectedHealth, actualHealth);
 }
Exemplo n.º 9
0
    private void Start()
    {
        playerLives = GetComponent <PlayerLives>();
        if (!playerLives)
        {
            Debug.LogError("Player doesn't have a lives script.");
        }

        _UIManager = FindObjectOfType <UIManager>();
        if (!_UIManager)
        {
            Debug.LogError("UI Manager is null");
        }

        _audioSource = GetComponent <AudioSource>();
        if (!_audioSource)
        {
            Debug.LogError("Player audio is null");
        }

        _gameManager = FindObjectOfType <GameManager>();
        if (!_gameManager)
        {
            Debug.LogError("Game manager is null");
        }

        _myAnimator = GetComponent <Animator>();
        if (!_myAnimator)
        {
            Debug.LogError("Player doesn't have an animator.");
        }

        GainAmmo();
        GainMissiles();
    }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        GameoverCanvas = GetComponent <Canvas>();

        GameoverCanvas.enabled = false;
        GameIsOver             = false;
        playerLives            = FindObjectOfType <PlayerLives>();
    }
 public void TestHealthAfterDamagePlayer2()
 {
     PlayerLives playerLives = new PlayerLives ();
     int expectedHealth = 0;
     int actualHealth = playerLives.currentHealth2;
     actualHealth = actualHealth - playerLives.DamageHealthPlayer2();
     Assert.AreEqual (expectedHealth, actualHealth);
 }
Exemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     _lives = GameObject.FindGameObjectWithTag(_tag).GetComponent <PlayerLives> ();
     if (_lives == null)
     {
         print("NO " + _tag + " FOUND IN SCENE! @HealthUI");
     }
 }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     _PlayerLives = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLives> ();
     if (_PlayerLives == null)
     {
         print("No PlayerLives Detected in Scene @SceneManager");
     }
 }
Exemplo n.º 14
0
 //Get all necesary components
 private void Start()
 {
     moveAble       = gameObject.GetComponent <PlayerMovement>();
     inputManager   = GetComponent <PlayerInputManager>();
     playerLives    = gameObject.GetComponent <PlayerLives>();
     playerShooting = gameObject.GetComponent <PlayerShooting>();
     updateHearts   = gameObject.GetComponent <UpdateHearts>();
 }
Exemplo n.º 15
0
 void Update()
 {
     if (!player_lives_obj)
     {
         player_lives_obj = GameObject.FindObjectOfType <PlayerLives>();
         update_heart_containers();
     }
 }
Exemplo n.º 16
0
    public void TestHealthStartsAtThreePlayer2()
    {
        PlayerLives playerLives    = new PlayerLives();
        int         expectedHealth = 3;
        int         actualHealth   = playerLives.currentHealth2;

        Assert.AreEqual(expectedHealth, actualHealth);
    }
Exemplo n.º 17
0
    public void TestHealthAfterDamagePlayer2()
    {
        PlayerLives playerLives    = new PlayerLives();
        int         expectedHealth = 0;
        int         actualHealth   = playerLives.currentHealth2;

        actualHealth = actualHealth - playerLives.DamageHealthPlayer2();
        Assert.AreEqual(expectedHealth, actualHealth);
    }
Exemplo n.º 18
0
    public static void TriggerPlayerDeath()
    {
        PlayerLives.RemoveLife();

        if (OnPlayerDeath != null)
        {
            OnPlayerDeath();
        }
    }
Exemplo n.º 19
0
    void Start()
    {
        hearts[0]        = GameObject.Find("Heart1");
        hearts[1]        = GameObject.Find("Heart2");
        hearts[2]        = GameObject.Find("Heart3");
        player_lives_obj = GameObject.FindObjectOfType <PlayerLives>();

        update_heart_containers();
    }
Exemplo n.º 20
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     // Handle collision with player
     if (tag == "EnemyProjectile" && other.gameObject.tag == "Player")
     {
         PlayerLives playerScript = other.GetComponent <PlayerLives>();
         HurtPlayer(playerScript);
     }
 }
Exemplo n.º 21
0
 void HurtPlayer(PlayerLives playerScript)
 {
     if (!playerScript)
     {
         return;
     }
     playerScript.OnTakeDamage();
     Destroy(gameObject);
 }
    void Awake()
    {
        score = 0;
          checkpoint = transform;
          playerHealth = gameObject.GetComponent<Health>();
          sceneFadeInOut = GameObject.FindGameObjectWithTag(DoneTags.fader).GetComponent<DoneSceneFadeInOut>();

          playerLives = GameObject.FindGameObjectWithTag("PlayerLives").GetComponent<PlayerLives>();
    }
Exemplo n.º 23
0
    void Awake()
    {
        score          = 0;
        checkpoint     = transform;
        playerHealth   = gameObject.GetComponent <Health>();
        sceneFadeInOut = GameObject.FindGameObjectWithTag(DoneTags.fader).GetComponent <DoneSceneFadeInOut>();

        playerLives = GameObject.FindGameObjectWithTag("PlayerLives").GetComponent <PlayerLives>();
    }
Exemplo n.º 24
0
    public static void SaveData(PlayerLives playerLives)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/playerLives.save";
        FileStream      stream    = new FileStream(path, FileMode.Create);
        Save            save      = new Save();

        formatter.Serialize(stream, save);
        stream.Close();
    }
Exemplo n.º 25
0
 // Use this for initialization
 void Awake()
 {
     if (instance)
              DestroyImmediate(transform.gameObject);
          else
          {
              DontDestroyOnLoad(gameObject); DontDestroyOnLoad(transform.gameObject);
              instance = this;
          }
 }
Exemplo n.º 26
0
 // Start is called before the first frame update
 void Awake()
 {
     startJump    = false;
     rigidBody    = GetComponent <Rigidbody2D>();
     anim         = GetComponent <Animator>();
     UI           = GameObject.FindObjectOfType <UI_game>();
     audioManager = GameObject.FindObjectOfType <AudioManager>();
     levelManager = GameObject.FindObjectOfType <LevelManager>();
     player_lives = GameObject.FindObjectOfType <PlayerLives>();
 }
Exemplo n.º 27
0
    void Awake()
    {
        playerInput = GetComponent <PlayerInput> ();
        lives       = GetComponent <PlayerLives> ();

        pauseScreen = GetComponentInChildren <PauseScreen> ();

        player = FindObjectOfType <Player> ();

        gamePaused = false;
    }
Exemplo n.º 28
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
Exemplo n.º 29
0
    // Use this for initialization

    void Awake()
    {
        if (instance)
        {
            DestroyImmediate(transform.gameObject);
        }
        else
        {
            DontDestroyOnLoad(gameObject); DontDestroyOnLoad(transform.gameObject);
            instance = this;
        }
    }
Exemplo n.º 30
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     // Handle collision with player
     if (other.gameObject.tag == "Player")
     {
         PlayerLives playerScript = other.GetComponent <PlayerLives>();
         if (!playerScript)
         {
             return;
         }
         playerScript.OnTakeDamage();
     }
 }
Exemplo n.º 31
0
 public void Awake()
 {
     Cam                 = GameObject.Find("MainCam");
     yourMesh            = gameObject.GetComponent <Mesh>();
     spawner             = FindObjectOfType <Spawner>();
     pmanger             = FindObjectOfType <placementManger>();
     managerScript       = FindObjectOfType <Manager>();
     buttonManagerScript = FindObjectOfType <ButtonManager>();
     hueScript           = FindObjectOfType <PostProcesssorController>();
     scoreScript         = FindObjectOfType <Score>();
     livesScript         = FindObjectOfType <PlayerLives>();
     CreateInstructions();
     winNum = 0;
 }
Exemplo n.º 32
0
        void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }

            playerMovement = playerGameObject.GetComponentInChildren <PlayerMovement>();
            playerLives    = playerGameObject.GetComponentInChildren <PlayerLives>();
        }
Exemplo n.º 33
0
    void Start()
    {
        if (GameController.Instance.Players != null)
        {
            foreach (var item in GameController.Instance.Players)
            {
                PlayerLives pl = Instantiate(playerLivesPrefab, transform);
                pl.player             = item;
                pl.PlayerHeart.sprite = playerHearts[item.ID];
            }
        }

        EventHandler.Instance.Register(EventHandler.EventType.HitEvent, UpdateLives);
    }
Exemplo n.º 34
0
 void OnPlayerLifeChanged()
 {
     if (GameMode == (int)GameModes.Casual)
     {
         LivesText.text = "CASUAL";
     }
     else if (GameMode == (int)GameModes.Normal)
     {
         LivesText.text = PlayerLives.ToString();
     }
     if (PlayerLives <= 0)
     {
         GameOver();
     }
 }
Exemplo n.º 35
0
 public PlayerLifeManager(EverLite game)
 {
     this.game         = game;
     lives             = new PlayerLives(10);
     player            = Player.Instance();
     sound             = SoundManager.Instance;
     volume            = VolumeManager.Instance;
     display           = new PlayerLivesDisplay(lives);
     player.OnCollide += (sender, e) => { lives.TakeDamage(); };
     lives.OnDeath    += (sender, e) => {
         this.sound.Losing.Play(volume: volume.SoundLevel, pitch: 0.0f, pan: 0.0f);
         this.game.SceneManager.ChangeMusic(this.sound.Megalovania);
         this.game.SceneManager.SwitchScene(this.game.SceneManager.GameOver);
     };
 }
Exemplo n.º 36
0
    //private int lives;
    void Awake()
    {
        //enabled = false;
        if (damagePrefab) {
        if (damageEffectTransform == null)
            damageEffectTransform = transform;
        GameObject effect = Spawner.Spawn (damagePrefab, Vector3.zero, Quaternion.identity);
        effect.transform.parent = damageEffectTransform;
        effect.transform.localPosition = Vector3.zero;
        damageEffect = effect.GetComponent<ParticleEmitter>();
        Vector2 tempSize = new Vector2(GetComponent<Collider>().bounds.extents.x,GetComponent<Collider>().bounds.extents.z);
        colliderRadiusHeuristic = tempSize.magnitude * 0.5f;
        damageEffectCenterYOffset = GetComponent<Collider>().bounds.extents.y;

        }
        if (scorchMarkPrefab) {
        scorchMark = GameObject.Instantiate(scorchMarkPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        scorchMark.SetActive (false);
        }
        sceneFadeInOut = GameObject.FindGameObjectWithTag(DoneTags.fader).GetComponent<DoneSceneFadeInOut>();
        gameTheme1 = GameObject.FindGameObjectWithTag("AlarmSound").GetComponent<AudioSource>();
        Debug.Log(gameTheme1.name);
        gameTheme2 = GameObject.FindGameObjectWithTag("GameController").GetComponent<AudioSource>();
           sirenGameObjects = GameObject.FindGameObjectsWithTag(DoneTags.siren);

           // if (gameTheme != null) Debug.Log("music found");

           scoreController = GameObject.FindGameObjectWithTag("Player").GetComponent<SpawnAtCheckpoint>();
           checkLives = false;
           playerLives = GameObject.FindGameObjectWithTag("PlayerLives").GetComponent<PlayerLives>();
         //  lives = playerLives.lives;
    }
Exemplo n.º 37
0
	// Use this for initialization
	void Start () {
		life = GameObject.FindObjectOfType<PlayerLives> ();
		SpawnPlayerShip();
	}