Commit 354f3ba1 authored by mthiele2's avatar mthiele2
parents b72497a5 2311e2a8
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Fun : MonoBehaviour
{
public Rigidbody2D fun;
private bool change = true;
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.B))
{
if (change)
{
fun.constraints = RigidbodyConstraints2D.FreezeRotation;
change = false;
}
else if(!change)
{
fun.constraints = RigidbodyConstraints2D.None;
change = true;
}
}
}
}
fileFormatVersion: 2
guid: 3a438a4cc738ff343951a6ef6af9f954
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -25,7 +25,18 @@ public class Life : MonoBehaviour {
}
}
public bool Heal(int amount){
public void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag.Equals("Respawn") && this.tag.Equals("Player"))
{
if (currentLife <= 3)
{
Heal(1);
}
}
}
public bool Heal(int amount){
if(currentLife == m_MaxLife){
return false;
}else{
......
......@@ -22,12 +22,18 @@ public class SavePoint : MonoBehaviour
public void OnTriggerEnter2D(Collider2D other)
{
options.gameObject.SetActive(true);
if (other.tag.Equals("Player"))
{
options.gameObject.SetActive(true);
}
}
public void OnTriggerExit2D(Collider2D other)
{
options.gameObject.SetActive(false);
if (other.tag.Equals("Player"))
{
options.gameObject.SetActive(false);
}
}
public void OnTriggerStay2D(Collider2D collision)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment