void Awake()
 {
     health   = GetComponentInChildren <Player_HealthController>();
     movement = GetComponent <PlanetMovement>();
     ability  = GetComponent <ISpecialAbility>();
     Camera.main.GetComponent <CameraFollow>().AddPlayers(gameObject.transform);
 }
示例#2
0
 void Start()
 {
     controller       = GetComponentInParent <PlayerController>();
     movement         = GetComponentInParent <PlanetMovement>();
     healthController = GetComponentInParent <Player_HealthController>();
     controller.SetPlanetProtection(true);
 }
示例#3
0
    protected virtual void OnTriggerEnter2D(Collider2D other)
    {
        target = other.transform.root.GetComponent <Player_HealthController>();

        //Hit the target if it is damageable
        if (target != null)
        {
            target.Heal(healthBonus);
            AudioManager1.instance.Play(healSound);
            Destroy(gameObject);
        }
    }
示例#4
0
    private void CheckHealth(Player_HealthController planet_HealthController, List <GameObject> hpBars, float playerHealth, Material playerMaterial)
    {
        if (planet_HealthController.health <= 4)
        {
            DeactivateHealthBars(hpBars, playerHealth);
            playerMaterial.color = colors[1];

            for (int i = 0; i < hpBars.Count - 1; i++)
            {
                hpBars[i].SetActive(true);
            }
        }
        if (planet_HealthController.health <= 3)
        {
            DeactivateHealthBars(hpBars, playerHealth);
            playerMaterial.color = colors[2];

            for (int i = 0; i < hpBars.Count - 2; i++)
            {
                hpBars[i].SetActive(true);
            }
        }
        if (planet_HealthController.health <= 2)
        {
            DeactivateHealthBars(hpBars, playerHealth);
            playerMaterial.color = colors[3];

            for (int i = 0; i < hpBars.Count - 3; i++)
            {
                hpBars[i].SetActive(true);
            }
        }
        if (planet_HealthController.health <= 1)
        {
            DeactivateHealthBars(hpBars, playerHealth);

            for (int i = 0; i < hpBars.Count - 4; i++)
            {
                hpBars[i].SetActive(true);
            }
        }
        if (planet_HealthController.health <= 0)
        {
            DeactivateHealthBars(hpBars, playerHealth);

            for (int i = 0; i < hpBars.Count - 5; i++)
            {
                hpBars[i].SetActive(true);
            }
        }
    }
示例#5
0
    protected virtual void OnTriggerEnter2D(Collider2D other)
    {
        target = other.transform.root.GetComponent <Player_HealthController>();

        //Hit the target if it is damageable
        if (target != null)
        {
            if (heal)
            {
                target.Heal(healthBonus);
            }
            else
            {
                target.Hit(damage, DamageType.physical, Vector2.zero, dmgStunTime);
            }

            Destroy(gameObject);
        }
    }
示例#6
0
 private void SortPlayers(List <GameObject> playerList)
 {
     _player1 = playerList[0];
     if (playerList[0] != null)
     {
         _p1HealthController = playerList[0].GetComponent <Player_HealthController>();
     }
     _player2 = playerList[1];
     if (playerList[1] != null)
     {
         _p2HealthController = playerList[1].GetComponent <Player_HealthController>();
     }
     _player3 = playerList[2];
     if (playerList[2] != null)
     {
         _p3HealthController = playerList[2].GetComponent <Player_HealthController>();
     }
     _player4 = playerList[3];
     if (playerList[3] != null)
     {
         _p4HealthController = playerList[3].GetComponent <Player_HealthController>();
     }
 }
 void Start()
 {
     playerNr         = GetComponent <PlayerController>().playerNr;
     healthController = GetComponent <Player_HealthController>();
     playerUI         = FindObjectOfType <PlayerUI>();
 }
示例#8
0
 void Awake()
 {
     health   = GetComponentInChildren <Player_HealthController>();
     movement = GetComponent <PlanetMovement>();
 }