Initial commit
This commit is contained in:
+72
@@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SojaExiles
|
||||
|
||||
{
|
||||
public class opencloseWindow : MonoBehaviour
|
||||
{
|
||||
|
||||
public Animator openandclosewindow;
|
||||
public bool open;
|
||||
public Transform Player;
|
||||
|
||||
void Start()
|
||||
{
|
||||
open = false;
|
||||
}
|
||||
|
||||
void OnMouseOver()
|
||||
{
|
||||
{
|
||||
if (Player)
|
||||
{
|
||||
float dist = Vector3.Distance(Player.position, transform.position);
|
||||
if (dist < 15)
|
||||
{
|
||||
if (open == false)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
StartCoroutine(opening());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (open == true)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
StartCoroutine(closing());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IEnumerator opening()
|
||||
{
|
||||
print("you are opening the Window");
|
||||
openandclosewindow.Play("Openingwindow");
|
||||
open = true;
|
||||
yield return new WaitForSeconds(.5f);
|
||||
}
|
||||
|
||||
IEnumerator closing()
|
||||
{
|
||||
print("you are closing the Window");
|
||||
openandclosewindow.Play("Closingwindow");
|
||||
open = false;
|
||||
yield return new WaitForSeconds(.5f);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 817d7f89b6e10ed4d804fa09670bf2ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SojaExiles
|
||||
|
||||
{
|
||||
public class opencloseWindow1 : MonoBehaviour
|
||||
{
|
||||
|
||||
public Animator openandclosewindow1;
|
||||
public bool open;
|
||||
public Transform Player;
|
||||
|
||||
void Start()
|
||||
{
|
||||
open = false;
|
||||
}
|
||||
|
||||
void OnMouseOver()
|
||||
{
|
||||
{
|
||||
if (Player)
|
||||
{
|
||||
float dist = Vector3.Distance(Player.position, transform.position);
|
||||
if (dist < 15)
|
||||
{
|
||||
if (open == false)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
StartCoroutine(opening());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (open == true)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
StartCoroutine(closing());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IEnumerator opening()
|
||||
{
|
||||
print("you are opening the Window");
|
||||
openandclosewindow1.Play("Openingwindow 1");
|
||||
open = true;
|
||||
yield return new WaitForSeconds(.5f);
|
||||
}
|
||||
|
||||
IEnumerator closing()
|
||||
{
|
||||
print("you are closing the Window");
|
||||
openandclosewindow1.Play("Closingwindow 1");
|
||||
open = false;
|
||||
yield return new WaitForSeconds(.5f);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79023f3c1c542ca478d98525efcaa0bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user