Ejemplo n.º 1
0
 public RoboExplorer(string robotName, ServerCommunications serverCommunications, MoveCreator moveCreator, TimeSleeper timeSleeper, int timeToWaitForNextMove)
 {
     this.robotName = robotName;
     this.serverCommunications = serverCommunications;
     this.moveCreator = moveCreator;
     this.timeSleeper = timeSleeper;
     this.timeToWaitForNextMove = timeToWaitForNextMove;
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Method to spawn a version of the character prefab with the necessary components to record moves in the editor scene.
    /// See google document for more information about what parts should be active in the edtior scene.
    /// </summary>
    public void SpawnCharacter()
    {
        GameObject preInitCharacter = Resources.Load("Prefabs/Character", typeof(GameObject)) as GameObject;
        GameObject character        = Instantiate(preInitCharacter);

        character.transform.name = "Character";
        moveCreator         = gameObject.GetComponent <MoveCreator>();
        moveCreator.enabled = true;

        Destroy(character.GetComponent <Rigidbody2D>());

        // Destroy all rigid bodies since dragpoints does not work with them attached.
        foreach (Transform child in character.GetComponentsInChildren <Transform>(true))
        {
            Destroy(child.transform.GetComponent <Rigidbody2D>());
        }

        character.transform.position   = new Vector3(x1, y1, 0);
        character.transform.localScale = new Vector3(xScale, yScale, 1f);

        SpawnOnionCharacter();

        moveCreator.CharacterSpawned();
    }