Commit e8a6f296 by Alisa Jung

added trap

parent 39e9d223
fileFormatVersion: 2
guid: 5fcd7bbd646a82a4b9e4aa5229a903e3
timeCreated: 1433444182
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -192,15 +192,7 @@ public class CharacterController2D : MonoBehaviour
// here, we trigger our properties that have setters with bodies
skinWidth = _skinWidth;
// we want to set our CC2D to ignore all collision layers except what is in our triggerMask
for( var i = 0; i < 32; i++ )
{
// see if our triggerMask contains this layer and if not ignore it
if( ( triggerMask.value & 1 << i ) == 0 )
Physics2D.IgnoreLayerCollision( gameObject.layer, i );
}
}
}
public void OnTriggerEnter2D( Collider2D col )
......
using UnityEngine;
using System.Collections;
public class Trap : MonoBehaviour {
public int damagePoints = 10;
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
other.GetComponent<PlayerHealth>().changeHealthBy(-damagePoints);
transform.position = new Vector2(50, 50);//TODO setze auf 1000 oder so, zur sicherheit.
}
}
}
fileFormatVersion: 2
guid: 892b1835747e24741b4e2d180e492fc9
timeCreated: 1433442967
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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