max89max d81680c68b 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.
2015-11-07 20:58:51 +01:00

41 lines
867 B
C#

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);
}
}