Xavier314 a201fdc345 new file: Assets/Animations/Jump0.anim
new file:   Assets/Animations/Jump0.anim.meta
	renamed:    Assets/Sprites/Shooting.anim -> Assets/Animations/Shooting.anim
	renamed:    Assets/Sprites/Shooting.anim.meta -> Assets/Animations/Shooting.anim.meta
	modified:   Assets/Animations/megaman.controller
	modified:   Assets/Scenes/XavierScene.unity
	modified:   Assets/Scripts/Animations.cs
	modified:   Assets/Scripts/Control.cs
	modified:   Assets/Scripts/Gravity.cs
	modified:   Assets/Scripts/Jump.cs
	new file:   Assets/Scripts/MainCamera.cs
	new file:   Assets/Scripts/MainCamera.cs.meta
	modified:   Assets/Sprites/mm.png.meta
	modified:   ProjectSettings/TagManager.asset
2015-11-07 20:35:49 -05:00

54 lines
1007 B
C#

using UnityEngine;
using System.Collections;
public class Gravity : MonoBehaviour {
public Character player;
void Start()
{
player = new Character(1, 10, 10, false);
}
// Update is called once per frame
void Update () {
if (!player.isTouchingTheFloor())
{
this.gameObject.transform.Translate(0,-0.1f,0);
}
if (Input.GetKey("p"))
{
player.setTouchingTheFloor(false);
}
}
void OnTriggerStay2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
player.setTouchingTheFloor(true);
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
player.setTouchingTheFloor(false);
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
player.setTouchingTheFloor(true);
}
}
}