Commit 0797bc3b authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

tent gives visual display when ready to interact

parent d704d657
......@@ -118,6 +118,123 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4118635779259584, guid: 36e15d0d933814ddd8f60f70726d5cdd,
type: 2}
m_PrefabInternal: {fileID: 1404345547}
--- !u!1 &113816536
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1142052670255770, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 113816537}
- component: {fileID: 113816540}
- component: {fileID: 113816539}
- component: {fileID: 113816538}
m_Layer: 5
m_Name: InteractButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &113816537
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224018282793070894, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 113816536}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1817894540}
m_Father: {fileID: 2138223315}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -75}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &113816538
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114816900526660398, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 113816536}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 113816539}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &113816539
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114368199130414440, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 113816536}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.01886791, g: 0.01886791, b: 0.01886791, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 9731ee7c67f86481aab7cece5317c667, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &113816540
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 222844216497792210, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 113816536}
m_CullTransparentMesh: 0
--- !u!1 &221139806
GameObject:
m_ObjectHideFlags: 0
......@@ -802,6 +919,7 @@ Transform:
- {fileID: 792304765}
- {fileID: 1583296512}
- {fileID: 258363427}
- {fileID: 2138223315}
m_Father: {fileID: 757305217}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -816,6 +934,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6b09055ef51c376479f7b3466f44b7f6, type: 3}
m_Name:
m_EditorClassIdentifier:
interactButton: {fileID: 113816538}
--- !u!61 &601223112
BoxCollider2D:
m_ObjectHideFlags: 0
......@@ -2933,6 +3052,85 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1817894539
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1999531773516422, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1817894540}
- component: {fileID: 1817894542}
- component: {fileID: 1817894541}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1817894540
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224742012649364082, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1817894539}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 113816537}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -21.7}
m_SizeDelta: {x: 126, y: 19.5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1817894541
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114983588390535474, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1817894539}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 34
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Interact
--- !u!222 &1817894542
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 222286130475247290, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1817894539}
m_CullTransparentMesh: 0
--- !u!1 &1821809447
GameObject:
m_ObjectHideFlags: 0
......@@ -3531,3 +3729,97 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2095949397}
m_CullTransparentMesh: 0
--- !u!1 &2138223314
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2138223315}
- component: {fileID: 2138223318}
- component: {fileID: 2138223317}
- component: {fileID: 2138223316}
m_Layer: 0
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2138223315
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138223314}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalScale: {x: 0.01, y: 0.01, z: 1}
m_Children:
- {fileID: 113816537}
m_Father: {fileID: 601223110}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 4.26, y: -0.97}
m_SizeDelta: {x: 300, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2138223316
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138223314}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2138223317
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138223314}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &2138223318
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138223314}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 519420031}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: -1020251125
m_SortingOrder: 0
m_TargetDisplay: 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TentInteractoins : MonoBehaviour {
public Button interactButton;
private GameObject player;
private BoxCollider2D thisCollider;
private ContactFilter2D filter = new ContactFilter2D();
......@@ -14,6 +17,7 @@ public class TentInteractoins : MonoBehaviour {
player = GameObject.FindWithTag("Player");
thisCollider = GetComponent<BoxCollider2D>();
filter.SetLayerMask(LayerMask.GetMask("Player"));
interactButton.gameObject.SetActive(false);
}
// Update is called once per frame
......@@ -26,7 +30,7 @@ public class TentInteractoins : MonoBehaviour {
}
}
void checkNearbyPlayers() {
private void checkNearbyPlayers() {
CapsuleCollider2D playerCol = player.GetComponent<CapsuleCollider2D>();
Collider2D[] foundPlayers = new Collider2D[1];
if (thisCollider.OverlapCollider(filter, foundPlayers) > 0) {
......@@ -43,11 +47,11 @@ public class TentInteractoins : MonoBehaviour {
}
void EnterInteractable() {
print(":ENTERED INTERACTION");
interactButton.gameObject.SetActive(true);
}
void ExitInteractable() {
print("EXIT INTERACTION");
interactButton.gameObject.SetActive(false);
}
}
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