Example #1
0
    public override void CollectObservations()
    {
        if (!active)
        {
            return;
        }
        Collider[] hitColliders = Physics.OverlapSphere(transform.position, 2f, rewardCubes, QueryTriggerInteraction.Collide);
        LightClosestNodes(hitColliders);

        Vector3    rayHeight = transform.position + new Vector3(0, -0.2f, 0);
        RaycastHit hit;
        float      rotation = 0;
        Quaternion rot      = Quaternion.AngleAxis(rotation, Vector3.up);

        for (int i = 0; i < 16; i++)
        {
            if (Physics.Raycast(rayHeight, transform.TransformDirection(rot * Vector3.forward), out hit, 10f, rewardCubes))
            {
                NodeComponent n = hit.collider.GetComponent <NodeComponent>();
                if (n != null)
                {
                    n.Light();
                }
            }
            rotation += 22.5f;
            rot       = Quaternion.AngleAxis(rotation, Vector3.up);
        }
        if (pushAgent.GetStepCount() > 1500)
        {
            this.TouchDown();
        }
    }