Ejemplo n.º 1
0
    private void Awake()
    {
        levelGenerator          = GetComponent <LevelGenerator>();
        levelGeometry           = levelGenerator.Generate();
        levelGeometry.parent    = transform;
        levelGeometry.position -= Vector3.forward * levelGenerator.LaneSize;
        initialPosition         = levelGeometry.position;

        var robot = RobotFactory.GetRobot(RobotChangeManager.CurrentType);

        robotMov = robot.GetComponent <RobotMovement> ();
        Debug.Assert(robotMov != null, "Robot Prefab has no Robot Movement Component");
        robotMov.Init(this);

        var spawners = GetComponentsInChildren <Spawner> ();

        foreach (var s in spawners)
        {
            s.Init(this);
        }

        var hudController = GetComponentInChildren <HUDController> ();

        if (hudController != null)
        {
            hudController.Init(robot);
        }

        FillAvailableLastLanes();
    }