Esempio n. 1
0
 void Start()
 {
     activeShield = false;
     shield.SetActive(false);
     powerupManager = FindObjectOfType <PowerupManager>();
     playerHealth   = FindObjectOfType <HealthPlayer>();
 }
Esempio n. 2
0
 private void Awake()
 {
     rb2d         = GetComponent <Rigidbody2D>();
     waveSpawner  = GetComponent <WaveSpawner>();
     anim         = GetComponent <Animator>();
     healthPlayer = GetComponent <HealthPlayer>();
 }
Esempio n. 3
0
    private void Start()
    {
        healthPlayer = GetComponent <HealthPlayer>();

        Player.Singleton.TakeHeatPointEvent += TakeHp;
        Player.Singleton.DeathEvent         += Fill;
    }
Esempio n. 4
0
 void MakeInstance()
 {
     if (instane == null)
     {
         instane = this;
     }
 }
    void SetCargerFalse(Collider2D col)
    {
        countCargerAgain = 0;
        countStartFollow = 0;

        carger = false;

        dir  = Vector2.zero;
        toGo = Vector2.zero;

        anim.SetBool("Carger", carger);

        firstTime = false;

        if (col.CompareTag("Player"))
        {
            HealthPlayer healthPlayer = col.GetComponent <HealthPlayer>();
            healthPlayer.Damage(damage);
            GetComponent <AudioManagerEnemies>().PlayAudiosAttack();
            carger = false;
            if (healthPlayer.IsDead())
            {
                StartCoroutine(ResetPos());
            }
        }
        else
        {
            if (!hasFlipped)
            {
                Flip();
                hasFlipped = true;
            }
        }
    }
Esempio n. 6
0
 // Use this for initialization
 void Start()
 {
     zombieBody     = GetComponent <Rigidbody2D> ();
     zombieRenderer = GetComponent <SpriteRenderer> ();
     animator       = GetComponent <Animator> ();
     health         = GameObject.Find("Player").GetComponent <HealthPlayer> ();
 }
Esempio n. 7
0
        UnityEngine.AI.NavMeshAgent nav; // Reference to the nav mesh agent.


        void Awake()
        {
            // Set up the references.
            player       = GameObject.FindGameObjectWithTag("Player").transform;
            playerHealth = player.GetComponent <HealthPlayer> ();
            enemyHealth  = GetComponent <EnemyHealth> ();
            nav          = GetComponent <UnityEngine.AI.NavMeshAgent> ();
        }
Esempio n. 8
0
        float timer;                                // Timer for counting up to the next attack.


        void Awake()
        {
            // Setting up the references.
            player       = GameObject.FindGameObjectWithTag("Player");
            playerHealth = player.GetComponent <HealthPlayer> ();
            enemyHealth  = GetComponent <EnemyHealth>();
            anim         = GetComponent <Animator> ();
        }
 void Start()
 {
     vidas = GetComponent <HealthPlayer>();
     if (respawn)
     {
         Spawn();
     }
 }
Esempio n. 10
0
    void Start()
    {
        health = GameObject.FindObjectOfType <HealthPlayer>();
        //GameObject h = GameObject.FindGameObjectWithTag("Grandma");

        //Debug.Log(h.name);
        //health = h.GetComponent<HealthPlayer>();
        Debug.Log("Health: " + health.maxHealth);
    }
Esempio n. 11
0
    private void Start()
    {
        player = GameObject.Find("Player");

        playerHealth = player.GetComponent <HealthPlayer>();

        playerMovements = player.GetComponent <Movements>();

        sprite = GetComponent <SpriteRenderer>();
    }
Esempio n. 12
0
    void Start()
    {
        animator = GetComponent <Animator>();

        playerCaracteristics = GetComponent <PlayerCaracteristics>();

        playerAbilities = GetComponent <PlayerAbilitiesBis>();

        healthPlayerScript = GetComponent <HealthPlayer>();
    }
Esempio n. 13
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Destroy(this.gameObject, 0);
        HealthPlayer player = other.GetComponent <HealthPlayer>();

        //Si colisiona con el jugador
        if (player != null)
        {
            player.LoseHearts(damage);
        }
    }
Esempio n. 14
0
    //    public GameObject player;

    void Awake()
    {
//        health = player.GetComponent<HealthPlayer>();
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player)
        {
            health = player.GetComponent <HealthPlayer>();
        }

        gameManager = GameObject.Find("GamePlayManager");
    }
Esempio n. 15
0
    private void Start()
    {
        player = GameObject.Find("Player");

        playerHealth = player.GetComponent <HealthPlayer>();

        enemyHealthBar = Instantiate(enemyHealthBarPrefab, new Vector2(transform.position.x, transform.position.y + 1), Quaternion.identity);

        enemyHealthBar.transform.parent = transform;

        enemyHealthScript = enemyHealthBar.GetComponent <EnemyHealthBar>();
    }
    void Awake()
    {
        // Set up the references.
        player    = GameObject.FindGameObjectWithTag("Player").transform;
        enemyMask = LayerMask.GetMask("Shootable");

        playerHealth    = player.GetComponent <HealthPlayer> ();
        enemyHealth     = GetComponent <EnemyHealth> ();
        nav             = GetComponent <NavMeshAgent> ();
        enemyHealth     = GetComponent <EnemyHealth> ();
        anim            = GetComponent <Animator> ();
        resetEnemyStats = GetComponent <EnemyResetStats> ();
    }
Esempio n. 17
0
 void Awake()
 {
     inputState         = GetComponent <InputState> ();
     runBehaviour       = GetComponent <Run> ();
     jumpBehaviour      = GetComponent <Jump> ();
     animator           = GetComponent <Animator> ();
     collisionState     = GetComponent <CollisionState> ();
     duckBehaviour      = GetComponent <Duck> ();
     attackBehaviour    = GetComponent <Attack> ();
     knockbackBehaviour = GetComponent <Knockback> ();
     equipBehaviour     = GetComponent <Equip> ();
     health             = GetComponent <HealthPlayer> ();
 }
Esempio n. 18
0
 private void OnEnable()
 {
     healthPlayer = GetComponent <HealthPlayer>();
     Debug.Log("vidas restantes " + healthPlayer.LivesRemaining());
     Debug.Log(healthPlayer.maxHealth);
     for (int i = 0; i < lives; i++)
     {
         if (healthPlayer.LivesRemaining() < healthPlayer.maxHealth)
         {
             healthPlayer.AddLife();
         }
     }
     Debug.Log("vidas tras curarte" + healthPlayer.LivesRemaining());
     DisableSandwich();
 }
Esempio n. 19
0
 public void NoDamageShield(BulletType type)
 {
     if (data.baseStats.bulletType[currentType].Equals(type))
     {
         Debug.Log("No Damage");
         HealthPlayer player = FindObjectOfType <HealthPlayer>();
         player.Damage(0);
     }
     else
     {
         Debug.Log("Damage");
         HealthPlayer player = FindObjectOfType <HealthPlayer>();
         Bullet       bullet = FindObjectOfType <Bullet>();
         player.Damage(bullet.damage);
     }
 }
Esempio n. 20
0
    private void Awake()
    {
        // вызываю при респавне объекта
        scriptCountKills = GameObject.Find("Scripts");

        if (gameObject.name == "player")
        {
            base.textNameItem = "Buy Health Point(+100)";

            if (base.ExistWord())
            {
                hp += 100;
                HealthPlayer healthPlayerText = gameObject.GetComponent <HealthPlayer>();
                healthPlayerText.SubtractionHP(0, 200);
            }
        }
    }
Esempio n. 21
0
    private void Start()
    {
        enemiesTransform = groupEnemies.GetComponent <Transform>();

        playerHealth = player.GetComponent <HealthPlayer>();

        GameObject enemy1 = Instantiate(enemy1Prefab);
        GameObject enemy2 = Instantiate(enemy2Prefab);

        enemy1.transform.parent = enemiesTransform;
        enemy2.transform.parent = enemiesTransform;

        playerHealthOne   = GameObject.Find("SEG1");
        playerHealthTwo   = GameObject.Find("SEG2");
        playerHealthThree = GameObject.Find("SEG3");
        playerHealthFour  = GameObject.Find("SEG4");
        playerHealthFive  = GameObject.Find("SEG5");
    }
    private void OnCollisionStay2D(Collision2D collision)
    {
        shield = GetComponentInChildren <Shield>();
        Debug.Log("collision stay");
        HealthPlayer player = collision.collider.GetComponent <HealthPlayer>();

        if (swat != null)
        {
            if (shield != null && player != null)
            {
                player.LoseHearts(damage);
            }
            else if (shield == null && player != null)
            {
                player.LoseHearts(damage);
            }
        }
    }
Esempio n. 23
0
    void Awake()
    {
        moveHorizontal = true;
        myBody         = GetComponent <Rigidbody2D>();
        m_PhotonView   = GetComponent <PhotonView>();

        if (defaultbulletConfig == null)
        {
            Debug.LogWarning("MovementComponent, misisng default config !!");
            enabled = false;//deactive
        }
        else
        {
            activeBulletConfig = defaultbulletConfig;
        }

        healthPlayer = GetComponent <HealthPlayer>();
    }
Esempio n. 24
0
    void Awake()
    {
        Destroy(gameObject, DestroyTime);
        MakeInstance();
        spriteItem = GetComponent <SpriteRenderer>();
        boxItem    = GetComponent <BoxCollider2D>();

        Player = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthPlayer>();

        isMusic = PlayerPrefs.GetString("Music");
        if (isMusic == "Off")
        {
            audioSource.mute = true;
        }
        else
        {
            audioSource.mute = false;
        }
    }
    private void OnTriggerStay2D(Collider2D collision)
    {
        HealthPlayer player = collision.GetComponent <HealthPlayer>();

        if (preso != null)
        {
            if (player != null)
            {
                animator.SetBool("Atizando", true);
                player.LoseHearts(damage);
            }
        }
        else
        {
            //Si colisiona con el jugador
            if (player != null)
            {
                player.LoseHearts(damage);
            }
        }
    }
Esempio n. 26
0
    private void SetDamages(int p_Damages)
    {
        Collider[] l_HitCollider = Physics.OverlapSphere(transform.position, m_Radius, m_Layer);
        foreach (var item in l_HitCollider)
        {
            if (item.GetComponent <Enemy>() != null)
            {
                m_Enemy = item.GetComponent <Enemy>();
                m_Enemy.TakeDamages(p_Damages);
                Destroy(gameObject);
            }

            if (item.GetComponent <HealthPlayer>() != null)
            {
                m_PlayerLife = item.GetComponent <HealthPlayer>();
                m_PlayerLife.TakesDamages(p_Damages);
                Destroy(gameObject);
            }

            Debug.Log("j'ai touché : " + item.gameObject.name);
        }
    }
Esempio n. 27
0
    void OnTriggerEnter2D(Collider2D triggerCollider)
    {
        if (triggerCollider.tag == "Grandma")
        {
            SoundManager.PlaySound("punch");
            Destroy(gameObject);
        }

        if (triggerCollider.tag == "Umbrella")
        {
            SoundManager.PlaySound("ding");
            HealthPlayer hp = FindObjectOfType <HealthPlayer>();
            Debug.Log("cp1");
            int i = hp.positions.FindIndex(gp => gp.position.position.Equals(triggerCollider.gameObject.transform.position));
            Debug.Log(i);
            hp.positions[i] = new GrandmaPositions(hp.positions[i].position, false);
            Debug.Log("cp2");
            score.Cash.Value += 20;
            Destroy(triggerCollider.gameObject);
            Destroy(gameObject);
        }
    }
Esempio n. 28
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Enemy"))
        {
            Debug.Log("Enemigo");

            Enemy enemy = other.GetComponent <Enemy>();
            if (enemy != null)
            {
                Debug.Log("Buuu");

                enemy.Damage(damage);
                Destroy(this.gameObject);
            }
        }

        if (other.CompareTag("Player"))
        {
            HealthPlayer player = other.GetComponent <HealthPlayer>();

            if (player != null)
            {
                player.Damage(damage);
                Destroy(this.gameObject);
            }
        }

        if (other.CompareTag("EnemyBullet"))
        {
            Destroy(other.gameObject);
            Destroy(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject, 1f);
        }
    }
Esempio n. 29
0
 // Use this for initialization
 void Start()
 {
     terserah = GameObject.Find("HeadCollider");
     script   = (PlayerHealth)terserah.GetComponent(typeof(PlayerHealth));
     script2  = (HealthPlayer)terserah.GetComponent(typeof(HealthPlayer));
 }
Esempio n. 30
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.FindGameObjectWithTag ("Player");
         playerHealth = Player.GetComponent <HealthPlayer> ();
 }
Esempio n. 31
0
 void Start()
 {
     bigGhostRenderer = GetComponent <SpriteRenderer> ();
     health           = GameObject.Find("Player").GetComponent <HealthPlayer> ();
     spawner          = GameObject.Find("Spawner").GetComponent <Spawner> ();
 }