Example #1
0
    void Start()
    {
        //Get the other parts of the player
        health = GetComponent<UniversalHealth> ();
        particles = GetComponent<ParticleSystem> ();

        //Get the other player
        otherPlayer = GameObject.Find(gameObject.name == "player1" ? "player2" : "player1");
    }
Example #2
0
    void Start()
    {
        //Get the other parts of the player
        health    = GetComponent <UniversalHealth> ();
        particles = GetComponent <ParticleSystem> ();

        //Get the other player
        otherPlayer = GameObject.Find(gameObject.name == "player1" ? "player2" : "player1");
    }
Example #3
0
 void OnCollisionEnter(Collision col)
 {
     //print("collision player : " + col.gameObject.name + " player who spawned is : " + gameObject.name );
     if (col.gameObject.GetComponent<UniversalHealth>() && col.gameObject != playerShooting) {
         //Damage whatever collided with the projectile
         GameObject collidedObject = col.gameObject;
         health = collidedObject.GetComponent<UniversalHealth>();
         health.damagePlayer (projectileDamage);
         Destroy (gameObject, 0.5f);
     }
 }
Example #4
0
    void OnCollisionEnter(Collision col)
    {
        GameObject collidedObject = col.gameObject;

        if (collidedObject.name == "player1" || collidedObject.name == "player2")
        {
            //Damage whatever collided with the projectile
            health = collidedObject.GetComponent <UniversalHealth>();
            health.damagePlayer(projectileDamage);
        }
        Destroy(gameObject);
    }
Example #5
0
    void OnCollisionEnter(Collision col)
    {
        GameObject collidedObject = col.gameObject;

        if (collidedObject.name == "player1" || collidedObject.name == "player2")
        {
            //Damage whatever collided with the projectile
            health = collidedObject.GetComponent<UniversalHealth>();
            health.damagePlayer(projectileDamage);
        }
        Destroy(gameObject);
    }
Example #6
0
 void OnCollisionEnter(Collision col)
 {
     //print("collision player : " + col.gameObject.name + " player who spawned is : " + gameObject.name );
     if (col.gameObject.GetComponent <UniversalHealth>() && col.gameObject != playerShooting)
     {
         //Damage whatever collided with the projectile
         GameObject collidedObject = col.gameObject;
         health = collidedObject.GetComponent <UniversalHealth>();
         health.damagePlayer(projectileDamage);
         Destroy(gameObject, 0.5f);
     }
 }
Example #7
0
    void healPlayer(GameObject player)
    {
        UniversalHealth health = player.GetComponent <UniversalHealth> ();

        health.healPlayer(magnitude);
    }
Example #8
0
 // Use this for initialization
 void Start()
 {
     playerHealth = player.GetComponent <UniversalHealth> ();
     playerStatus = player.GetComponent <PlayerControl> ();
     initialiseHealthBar();
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     playerHealth = player.GetComponent<UniversalHealth> ();
     playerStatus = player.GetComponent<PlayerControl> ();
     initialiseHealthBar ();
 }