Created
May 2, 2019 04:29
-
-
Save SenpaiRar/009bd3b93f48506ad795c796cced0387 to your computer and use it in GitHub Desktop.
This script is similar to the food script. It replenishes the player's water stat and then it deletes itself.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class WaterScript : ClickableParent { | |
public string Name; | |
public float water_Value; | |
public float MinimumDistance; | |
private Player_Manager Master_Manager; | |
public AudioClip Clip; | |
public AudioSource Source; | |
void Start () { | |
Master_Manager = GameObject.Find("Player").GetComponent<Player_Manager>(); | |
Source = GameObject.Find("Player").GetComponent<AudioSource>(); | |
} | |
public override void OnClick(Vector3 ClickPosition) | |
{ | |
if(Vector3.Distance(ClickPosition, transform.position) <= MinimumDistance){ | |
Master_Manager.current_Water_Level += water_Value; | |
Source.PlayOneShot(Clip); | |
Destroy(gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment