public void Awake() { mr = gameObject.transform.GetComponent <MeshRenderer>(); if (healthy == null) { healthy = mr.material; } if (sick == null) { sick = new Material(mr.material); sick.color = Color.red; } agc = this.gameObject.GetComponent <AgentBirthController>(); atc = this.gameObject.GetComponent <AgentTargetController>(); if (ic == null) { ic = IllnessController.Instance; } if (wc == null) { wc = WorldController.Instance; } if (mc == null) { mc = MovementController.Instance; } setRandomAge(); setRandomGender(); Illness = false; others = new List <AgentController>(); }
/* * private Vector3 currentVelocity = Vector3.zero; * private Vector3 velocity = Vector3.zero; * public Vector2 Velocity * { * set * { * velocity = new Vector3(value.x, 0.0f, value.y); * } * get * { * return new Vector2(velocity.x, velocity.z); * } * } */ public void Start() { if (movementController == null) { movementController = MovementController.Instance; speed = movementController.Speed * Time.deltaTime; } if (atc == null) { atc = transform.GetComponent <AgentTargetController>(); } bounds = movementController.Bounds; rb = this.gameObject.GetComponent <Rigidbody>(); }