Commit aa95120a authored by Markus Schlösser's avatar Markus Schlösser
Browse files

Fixed trigger errors

parent 27e06458
......@@ -22,7 +22,9 @@ GameObject:
- component: {fileID: 212359673814677190}
- component: {fileID: 114577748845638106}
- component: {fileID: 95392249558912674}
m_Layer: 0
- component: {fileID: 61539110044657252}
- component: {fileID: 50397689947908316}
m_Layer: 9
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -37,7 +39,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4547148712663108}
m_Layer: 0
m_Layer: 9
m_Name: Tracking Point
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -71,6 +73,51 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50397689947908316
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1170495321650788}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
--- !u!61 &61539110044657252
BoxCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1170495321650788}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.95, y: 0.95}
m_EdgeRadius: 0
--- !u!95 &95392249558912674
Animator:
serializedVersion: 3
......
......@@ -12,11 +12,10 @@ public class InteractibleTrigger : MonoBehaviour, IInteractible {
private PlayerActor player;
private void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("Player")) {
player = other.GetComponent<PlayerActor>();
if(player != null) {
player.Interactible = this;
}
player = other.GetComponent<PlayerActor>();
if(player != null) {
Debug.Log("Test");
player.Interactible = this;
}
}
......
......@@ -55,7 +55,7 @@ public class PlayerActor : MonoBehaviour {
transform.position = tilemap.GetCellCenterWorld(tilemap.WorldToCell(transform.position));
if (inputProvider.InteractionPressed) {
if (inputProvider.InteractionPressed && Interactible != null) {
Interactible.Interact();
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: 9cd430fb2c8ca37469ea84c38315c073
MonoImporter:
externalObjects: {}
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