mirror of
https://github.com/ConjureETS/EscapeTheRoom.git
synced 2026-03-24 01:00:58 +00:00
Merge branch 'master' of https://github.com/ETSConjure/EscapeTheRoom
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
parent
e8e7f8a23a
commit
d81680c68b
9
Assets/Scripts.meta
Normal file
9
Assets/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82200e55c3b1e4126883ef4efb2c9891
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1446924476
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
40
Assets/Scripts/monsterAI.cs
Normal file
40
Assets/Scripts/monsterAI.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class monsterAI : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject player;
|
||||||
|
private Transform target = player.transform;
|
||||||
|
public float deadlyDistance;
|
||||||
|
public float rotationDamping;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check is the current distance is deadly for the target
|
||||||
|
bool IsAtDeadlyDistance () {
|
||||||
|
return (deadlyDistance <= Vector3.Distance(target.position, transform.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Follow player from a certain initial distance at a certain speed.
|
||||||
|
void FollowTarget ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look toward target
|
||||||
|
void LookAtTarget () {
|
||||||
|
Quaternion rotation = Quaternion.LookRotation (target.rotation - transform.rotation);
|
||||||
|
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * rotationDamping);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Scripts/monsterAI.cs.meta
Normal file
12
Assets/Scripts/monsterAI.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 10ca748d7d0094f16b50525c5401d788
|
||||||
|
timeCreated: 1446922382
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user