Beispiel #1
0
    void Update()
    {
        if (canUpdate && spaceHandlerInstance.isPrimaryProcessingCompleted)
        {
            if (Vector3.Distance(oldPos, transform.position) > SpaceGraph.cellMinSideLength)
            {
                //                Debug.Log("position transformation happens");
                oldPos = transform.position;
                spaceHandlerInstance.UpdateGraphForObstacle(gameObject, cTSInstance.Token);
                canUpdate = false;
                StartCoroutine(allowUpdateTimer());
                return;
            }

            if (oldRot != transform.rotation)
            {
                //                   Debug.Log("rotation transformation happens");
                oldRot = transform.rotation;
                spaceHandlerInstance.UpdateGraphForObstacle(gameObject, cTSInstance.Token);
                canUpdate = false;
                StartCoroutine(allowUpdateTimer());
                return;
            }

            if (oldScale != transform.localScale)
            {
                //                Debug.Log("scale transformation happens");
                oldScale = transform.localScale;
                spaceHandlerInstance.UpdateGraphForObstacle(gameObject, cTSInstance.Token);
                canUpdate = false;
                StartCoroutine(allowUpdateTimer());
                return;
            }
        }
    }
Beispiel #2
0
 /// <summary>
 /// Process new obstacle, instantiated after primary processing.
 /// Or update existing (may be useful, if obstacle changed its position, rotation,etc.)</summary>
 /// <param name="obstacleGOToHandle">Obstacle game object to handle</param>
 public void HandleAnObstacle(GameObject obstacleGOToHandle)
 {
     spaceHandlerInstance.UpdateGraphForObstacle(obstacleGOToHandle, cTSInstance.Token);
 }