Created
September 13, 2015 23:53
-
-
Save lena3rika/50b37bbf4a97f6add237 to your computer and use it in GitHub Desktop.
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 UnityEngine; | |
public class HoverTarget : MonoBehaviour | |
{ | |
private Rigidbody2D rigidBody; | |
private bool stationary; | |
// Use this for initialization | |
void Start () | |
{ | |
rigidBody = GetComponent<Rigidbody2D> (); | |
stationary = true; | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
rigidBody.isKinematic = stationary; | |
} | |
void OnCollisionEnter2D(Collision2D collision) | |
{ | |
if(collision.gameObject.tag == "Projectile") | |
{ | |
stationary = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment