示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            //need to define playerHP in here on touch else null is thrown on player death
            playerHP = GameObject.FindGameObjectWithTag("Player").GetComponent <RainDamageHpHandler>();
            //take 50 from player health
            playerHP.playerSize -= 50f;
            //call the rescale script
            playerHP.changeSize.Rescale(playerHP.playerSize, playerHP.maxSize);
            //destroy the droplet
            Destroy(gameObject);
        }

        if (other.CompareTag("Ground"))
        {
            Destroy(gameObject);
        }
    }
示例#2
0
 private void Start()
 {
     //the character handler is the component attached to our player
     //charH = this.GetComponent<healthbar>();
     charHP = GetComponent <RainDamageHpHandler>();
     #region Check if we have Key
     if (PlayerPrefs.HasKey("SpawnPoint"))
     {
         //then our checkpoint is equal to the game object that is named after our save file
         curCheckpoint = GameObject.Find(PlayerPrefs.GetString("SpawnPoint"));
         //our transform.position is equal to that of the checkpoint
         transform.position = curCheckpoint.transform.position;
     }
     else
     {
         curCheckpoint = GameObject.FindGameObjectWithTag("SpawnP");
     }
     transform.position = curCheckpoint.transform.position;
     #endregion
 }
示例#3
0
 // Use this for initialization
 void Start()
 {
     playerRigid = GameObject.Find("Player").GetComponent <Rigidbody>();
     dashDir     = Vector3.zero; //set the initial dash direction to zero
     playerHP    = GetComponent <RainDamageHpHandler>();
 }
示例#4
0
    public float dripRate;               //rate at which droplets will be created



    // Use this for initialization
    void Start()
    {
        dir      = Vector3.down;
        playerHP = GameObject.FindGameObjectWithTag("Player").GetComponent <RainDamageHpHandler>();
        isDrip   = true;
    }