This file contains hidden or 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
public class Button_ColorMe : MonoBehaviour { | |
public GameObject target; | |
public void ChangeYourColor () { | |
var targetMe = target.GetComponent<Renderer>(); | |
targetMe.material.color = Color.green; | |
This file contains hidden or 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 UnityEngine; | |
using UnityEngine.UI; | |
public class NameTag : MonoBehaviour { | |
public string displayName; | |
public Text targetName; | |
private bool isDisplaying = false; | |
void Start() { |
This file contains hidden or 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
score_manager myScoreManager; | |
void Start() { | |
myScoreManager = GetComponent<score_manager>(); | |
} | |
void OnCollisionEnter(Collision target) { |
This file contains hidden or 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 UnityEngine; | |
using UnityEngine.UI; | |
public class score_manager : MonoBehaviour { | |
public Text txtScore; | |
private int myScore; | |
void Start () { | |
myScore = 0; |
This file contains hidden or 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
public Image healthBar; | |
public float maximumHealth = 100f; | |
public float currentHealth = 0f; | |
void Start() { | |
currentHealth = maximumHealth; | |
} | |
void Update() { |
This file contains hidden or 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
/*jshint browser:true */ | |
/*jshint devel:true */ | |
(function() { | |
"use strict"; | |
window.addEventListener('load', main); | |
function main(){ |
This file contains hidden or 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
public GameObject targetObj; | |
public float rotateSpeed = 2; | |
Vector3 offsetValue; | |
void Start() { | |
offsetValue = targetObj.transform.position - transform.position; | |
} | |
void LateUpdate() { |
This file contains hidden or 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
public GameObject targetObj; | |
private Vector3 offsetValue; | |
void Start() { | |
offsetValue = transform.position - targetObj.transform.position; | |
} | |
void Update() { | |
transform.position = targetObj.transform.position + offsetValue; | |
} |
This file contains hidden or 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
public GameObject targetObj; | |
public float smooth = 1; | |
Vector3 offsetValue; | |
void Start() { | |
offsetValue = transform.position - targetObj.transform.position; | |
} | |
void LateUpdate() { |
This file contains hidden or 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
public GameObject target; | |
void LateUpdate() { | |
transform.LookAt(target.transform); | |
} | |