Example #1
0
 void Awake()
 {
     if (env == null)
     {
         env = GetComponentInParent <RandomEnvironment>();
     }
 }
Example #2
0
 void Awake()
 {
     if (env == null)
     {
         env = transform.parent.Find("RandomEnvironment").GetComponent <RandomEnvironment>();
     }
     xDistance = env.width + margin;
     yDistance = 50;
     zDistance = env.length + margin;
 }
Example #3
0
    private void Awake()
    {
        if (env == null)
        {
            env = GetComponentInParent <RandomEnvironment>();
        }
        if (agent == null)
        {
            agent = transform.parent.GetComponentInChildren <VehicleAgent>();
        }
        if (background == null)
        {
            background = GetComponentInChildren <Transform>();
        }

        // Position overview at border (in corner?)
    }
Example #4
0
    private void Awake()
    {
        if (vehicleController == null)
        {
            vehicleController = GetComponent <NewCarController>();
        }
        if (agentRigidbody == null)
        {
            agentRigidbody = GetComponent <Rigidbody>();
        }
        if (depth == null)
        {
            depth = GetComponent <CameraSensorComponent>();
        }
        if (target == null)
        {
            target = transform.parent.Find("Target");
        }
        agentStartPosition = transform.position;
        agentStartRotation = transform.rotation;

        if (!training)
        {
            return;
        }

        if (env == null)
        {
            env = GetComponentInParent <RandomEnvironment>();
        }
        if (objectSpawner == null)
        {
            objectSpawner = transform.parent.Find("Object Spawner").GetComponent <ObjectSpawner>();
        }

        transform.parent        = env.transform;
        transform.localPosition = Vector3.zero;

        maxDistanceFromStart = Mathf.Max(
            env.length / 2,
            env.width / 2
            ) * 1.25f;
        maxDistanceFromStartSq = maxDistanceFromStart * maxDistanceFromStart;
    }
 void Awake()
 {
     if (env == null)
     {
         env = GetComponentInParent <RandomEnvironment>();
     }
     if (target == null)
     {
         target = transform.parent.Find("Target").gameObject;
     }
     if (targetRigigbody == null)
     {
         targetRigigbody = target.GetComponent <Rigidbody>();
     }
     if (targetArea == null)
     {
         targetArea = target.transform.Find("Area");
     }
 }
Example #6
0
    private void Awake()
    {
        if (env == null)
        {
            env = GetComponentInParent <RandomEnvironment>();
        }

        if (wall1 == null)
        {
            wall1 = transform.Find("Wall 1");
        }
        if (wall2 == null)
        {
            wall2 = transform.Find("Wall 2");
        }
        if (wall3 == null)
        {
            wall3 = transform.Find("Wall 3");
        }
        if (wall4 == null)
        {
            wall4 = transform.Find("Wall 4");
        }

        wall1.parent        = transform;
        wall1.localPosition = new Vector3(0, height / 2, -0.5f + env.width / 2);
        wall1.localScale    = new Vector3(env.width, height, 1);

        wall2.parent        = transform;
        wall2.localPosition = new Vector3(0, height / 2, 0.5f - env.width / 2);
        wall2.localScale    = new Vector3(env.width, height, 1);

        wall3.parent        = transform;
        wall3.localPosition = new Vector3(-0.5f + env.length / 2, height / 2, 0);
        wall3.localScale    = new Vector3(1, height, env.length - 2);

        wall4.parent        = transform;
        wall4.localPosition = new Vector3(0.5f - env.length / 2, height / 2, 0);
        wall4.localScale    = new Vector3(1, height, env.length - 2);
    }