Hello,
I have a gameObject called bad with a script called ‘bad’ attached to it. The script is totally ignored. I have a public Transform set to the player gameObject, and some other code, but not even start() seems to be called, as no break points are hit.
using UnityEngine;
using System.Collections;
public class bad : MonoBehaviour {
private Vector2 speed;
public Transform player;
private bool playerDetected;
private Vector3 destinationVector;
private Vector3 destinationPoint;
private bool moveComplete;
private bool moveInitiated;
// player rotation
private Vector3 zAxis = new Vector3(0, 0, 1);
// Use this for initialization
void Start () {
speed.x = 1.0f;
speed.y = 1.0f;
playerDetected = false;
moveComplete = false;
moveInitiated = false;
}
// Update is called once per frame
void Update () {
/*
if (playerDetected) {
// transform.RotateAround (player.transform.position, zAxis, 0.5f);
} else {
if(!moveInitiated)
{
Vector3 destinationVector = player.transform.position - transform.position;
destinationPoint = new Vector3(destinationVector.x + transform.position.x / 2.0f, destinationVector.y - transform.position.y / 2.0f, 0.0f);
moveInitiated = true;
if(!moveComplete && moveInitiated)
{
transform.position = Vector3.Lerp(transform.position,destinationPoint, 1.0f * Time.deltaTime);
if(Vector3.Distance(transform.position, destinationPoint) <= 8)
{
moveComplete = true;
moveInitiated = false;
}
}
}
}
// see if player is close enough to detect to go into player detected logic
if(Vector3.Distance(player.transform.position, transform.position) <= 8)
{
playerDetected = true;
}else{
playerDetected = false;
}
*/
}
}