Пример #1
0
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <PlayerController> ();

        camera = FindObjectOfType <CamerController>();

        healthManager = FindObjectOfType <HeatltManager>();
    }
Пример #2
0
    //public GameObject gameOverScreen;

    //public PlayerController player;

    // Use this for initialization
    void Start()
    {
        countingTime = startingTime;

        theText = GetComponent <Text>();

        thePauseMenu = FindObjectOfType <PauseMenu>();

        theHealth = FindObjectOfType <HeatltManager>();

        //player = FindObjectOfType<PlayerController>();
    }
Пример #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <PlayerController>() == null)
        {
            return;
        }

        HeatltManager.HurtPlayer(-healthToGive);

        pickupSound.Play();

        Destroy(gameObject);
    }
Пример #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            //Instantiate(enemyDeathEffect, other.transform.position, other.transform.rotation);
            //Destroy(other.gameObject);
            //ScoreManger.AddPoints(pointsForKill);

            HeatltManager.HurtPlayer(damageToGive);
        }

        Instantiate(impactEffect, transform.position, transform.rotation);
        Destroy(gameObject);
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            HeatltManager.HurtPlayer(damageToGive);
            other.GetComponent <AudioSource>().Play();

            var player = other.GetComponent <PlayerController>();
            player.knockbackCount = player.knockbackLength;

            if (other.transform.position.x < transform.position.x)
            {
                player.knockFromRight = true;
            }
            else
            {
                player.knockFromRight = false;
            }
        }
    }