protected void Awake()
 {
     Controllable = GetComponent<Controllable>();
     MoveTaskScript = GetComponent<MoveTaskScript>();
 }
Exemple #2
0
 public MoveTask(MoveTaskScript taskScript, Transform target)
     : base()
 {
     TaskScript = taskScript;
     targetTransform = target;
 }
Exemple #3
0
    protected void Awake()
    {
        controllable = GetComponent<Controllable>();
        personalAI = GetComponent<PersonalAI>();

        // A child GameObject is needed to attach a collider to. Attaching the collider to the parent object causes problems
        GameObject child = new GameObject(this.GetType().Name);
        child.transform.parent = transform;
        child.transform.localPosition = Vector3.zero;
        child.layer = LayerMask.NameToLayer("Ignore Raycast");

        // A capsule collider provides a trigger for the vision range
        VisionCollider = child.AddComponent<SphereCollider>();
        VisionCollider.isTrigger = true;
        VisionCollider.radius = visionRange;

        // A trigger script passes triggered events back to this one
        VisionTrigger trigger = child.AddComponent<VisionTrigger>();
        trigger.Vision = this;

        // Determine if this is a unit (the alternative would be a building)
        if(gameObject.CompareTag(GameUtil.TAG_UNIT)) {
            isUnit = true;
            moveTaskScript = GetComponent<MoveTaskScript>();
        }
    }
Exemple #4
0
 public MoveTask(MoveTaskScript taskScript, Vector3? target)
     : base()
 {
     TaskScript = taskScript;
     targetPoint = target;
 }