Skip to content
Snippets Groups Projects
Commit ae457af5 authored by Andi14-prog's avatar Andi14-prog
Browse files

Fixed Book Interaction and renamed it

parent b56766cd
No related branches found
No related tags found
No related merge requests found
......@@ -15,14 +15,16 @@ MonoBehaviour:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LowPolyDungeonsLite_BG
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF
m_ValidKeywords:
- _GLOSSYREFLECTIONS_OFF
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
......@@ -174,6 +176,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AORemapMax: 1
- _AORemapMin: 0
......
......@@ -2,14 +2,15 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Nature_Texture_01
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
......@@ -55,6 +56,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
......@@ -75,3 +77,4 @@ Material:
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Text;
public class SimpleMessageDisplay : MonoBehaviour
{
public GameObject messagePanel;
public Text messageText;
void Start()
{
messagePanel.SetActive(false);
}
void Update()
{
if (messagePanel.activeSelf && Input.GetKeyDown(KeyCode.Escape))
{
CloseMessage();
}
}
public void ShowMessage(string message)
{
messageText.text = message;
messagePanel.SetActive(true);
}
public void CloseMessage()
{
messagePanel.SetActive(false);
}
}
fileFormatVersion: 2
guid: 2e5490ec88fed3c4e839b1b471c80a2f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
public class ChangeOnClick : MonoBehaviour
public class BookGlowAndInteract : MonoBehaviour
{
// Drag and drop your materials in the Inspector
......@@ -11,14 +11,46 @@ public class ChangeOnClick : MonoBehaviour
private Renderer objectRenderer;
private Material originalMaterial;
private int counter;
private bool clicked;
private bool active;
private SimpleMessageDisplay messageDisplay;
private BrewingPotInteract brewingPot;
void Start()
{
objectRenderer = GetComponent<Renderer>();
originalMaterial = objectRenderer.material;
counter = 0;
active = false;
clicked = false;
messageDisplay = FindObjectOfType<SimpleMessageDisplay>();
brewingPot = FindObjectOfType<BrewingPotInteract>();
if (messageDisplay == null)
{
Debug.LogError("No SimpleMessageDisplay found!");
}
if (brewingPot == null)
{
Debug.LogError("No Brewing Pot found!");
}
}
void Update()
{
if(counter > 120 && !clicked) {
if(active){
objectRenderer.material = originalMaterial;
} else {
objectRenderer.material = newMaterial;
}
active = !active;
counter = 0;
} else {
counter++;
}
// Check for mouse button click
if (Input.GetMouseButtonDown(0))
{
......@@ -31,15 +63,10 @@ void Update()
// Check if the clicked object is this object
if (hit.transform == transform)
{
// Change the material
if (objectRenderer.material == originalMaterial)
{
objectRenderer.material = newMaterial;
}
else
{
clicked = true;
objectRenderer.material = originalMaterial;
}
messageDisplay.ShowMessage("Hallllooooo\n \n \n Close with ESC");
Debug.LogError("Hit registered Where text???!");
}
}
}
......
......@@ -15,6 +15,7 @@ public class BrewingPotInteract : MonoBehaviour
private int counter = 0;
private Renderer objectRenderer;
private bool finished = false;
private string lgs;
// Start is called before the first frame update
void Start()
......@@ -51,4 +52,8 @@ void OnMouseDown()
Debug.LogError("ClickTracker: Instance is null");
}
}
public string getLGS(){
return lgs;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment