public static void initialize()
    {
        if (is_initialized)
        {
            Debug.LogError("Program already initialized");
        }
        else
        {
            MapSetup.info_text.SetActive(false);
            MapSetup.info_pan.SetActive(false);
            MapSetup.start_time = Time.time;
            MapSetup.setTime();
            MapSetup.reset_food();
            Debug.Log(MapSetup.all_players);
            GameObject player = PhotonNetwork.Instantiate(
                "Player" + (MapSetup.player_no),
                GameObject.Find("Spawn" + (player_no)).transform.position,
                Quaternion.identity);
            is_initialized = true;
            Debug.Log("Ready " + MapSetup.player_no);

            if (Connector.is_host == 1)
            {
                PhotonNetwork.Instantiate(
                    "GhostA",
                    GameObject.Find("GhostASpawn").transform.position,
                    Quaternion.identity);
                PhotonNetwork.Instantiate(
                    "GhostB",
                    GameObject.Find("GhostBSpawn").transform.position,
                    Quaternion.identity);
            }
        }
    }
 void StartGame(int player_no, byte all_players)
 {
     MapSetup.player_no   = player_no;
     MapSetup.all_players = (int)all_players;
     MapSetup.player_text.GetComponent <Text>().text = "You are Player " + player_no;
     MapSetup.initialize();
 }
Exemple #3
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "PlayerContainer")
     {
         MapSetup.reset_food();
         Destroy(this.gameObject);
     }
 }
Exemple #4
0
        public ActionResult Post([FromBody] MapSetup setup)
        {
            var vCoords = new
            {
                Paper = setup.GetPaperBounds(),
                // CrossHair = setup.GetCrossHairCoordinates()
            };

            return(Ok(vCoords));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            MapSetup.AddMapOverlays(MapView);
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /// Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            MapSetup.AddMapOverlays(MapView);
        }
Exemple #7
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Exemple #8
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            // Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            // read json from assets and add to map
            var json = System.IO.File.ReadAllText(AssetUtils.CalculateResourcePath("capitals_3857.geojson"));

            MapSetup.AddJsonLayer(MapView, json);
        }
Exemple #9
0
        public async Task <FileStreamResult> Post([FromBody] MapSetup setup)
        {
            if (setup == null)
            {
                throw new ArgumentException("Unable to parse MapSetup parameter", "setup");
            }

            MapLoader vLoader = new MapLoader(setup);

            using (var vBitmap = await vLoader.CreateBitmapForPrintAsync())
            {
                var vStream = new MemoryStream();
                vBitmap.Save(vStream, System.Drawing.Imaging.ImageFormat.Jpeg);
                vStream.Position = 0;
                return(new FileStreamResult(vStream, "image/jpeg"));
            }
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            // read json from assets and add to map
            string json;

            using (System.IO.StreamReader sr = new System.IO.StreamReader(Assets.Open("capitals_3857.geojson")))
            {
                json = sr.ReadToEnd();
            }

            MapSetup.AddJsonLayer(MapView, json);
        }
Exemple #11
0
        public async Task <IActionResult> Post([FromBody] MapSetup setup)
        {
            if (setup == null)
            {
                throw new ArgumentException("Unable to parse MapSetup parameter", "setup");
            }

            MapLoader vLoader = new MapLoader(setup);

            using (var vBitmap = await vLoader.CreateBitmapForPrintAsync())
            {
                Guid   vFileID   = Guid.NewGuid();
                string vFilename = Path.Combine(Path.GetTempPath(), vFileID.ToString());
                using (var vFile = System.IO.File.Create(vFilename))
                {
                    await vLoader.CreatePDFWithPdfSharpAsync(vBitmap, setup.Title, null, vFile);
                }

                return(File(System.IO.File.ReadAllBytes(vFilename), "application/pdf"));
            }
        }
Exemple #12
0
 public void Setup()
 {
     MapInfo.InputFileContent = MapSetup.SetupInputContent();
 }
Exemple #13
0
 public MapBuildingTests()
 {
     Builder  = new MapBuilder();
     MapSetup = new MapSetup();
     MapInfo  = new MapModel();
 }
 public void Setup()
 {
     AdventuresDic = MapSetup.SetupAdventurers();
     Map           = MapSetup.SetupMapExampleTest();
 }
    // form connections between tiles
    void Start()
    {
        aus         = this.GetComponent <AudioSource>();
        timer       = GameObject.FindGameObjectWithTag("Finish");
        food        = GameObject.FindGameObjectsWithTag("Food");
        score_text  = GameObject.FindGameObjectsWithTag("Score");
        info_text   = GameObject.FindGameObjectWithTag("UIText");
        info_pan    = GameObject.FindGameObjectWithTag("UIPanel");
        player_text = GameObject.FindGameObjectWithTag("HostMsg");
        List <GameObject> wps = (new List <GameObject>(GameObject.FindGameObjectsWithTag("WP")));

        wps.AddRange(new List <GameObject>(GameObject.FindGameObjectsWithTag("GhostPen")));

        MapSetup.disable_food();
        foreach (GameObject wp in wps)
        {
            Collider[] wp_connections = Physics.OverlapSphere(
                wp.transform.position,
                wp_overlap,
                1 << 10 | 1 << 11
                );
            // Toroidal Behaviour
            if (Mathf.Abs(wp.transform.position.z) > (toroidal_north_south - wp_overlap))
            {
                Debug.Log("hitns" + wp.transform.position.z);
                NodeBehaviour wp_head_node = wp.GetComponent <NodeBehaviour>();
                wp_head_node.set_z_warp(true);
                Collider[] opposite_wp = Physics.OverlapSphere(
                    new Vector3(
                        wp.transform.position.x,
                        wp.transform.position.y,
                        -wp.transform.position.z),
                    wp_overlap / 2,
                    1 << 10 | 1 << 11
                    );
                if (wp.transform.position.z < 0)
                {
                    wp_head_node.connections.Add("Down", opposite_wp[0].gameObject);
                    //assign to the next node the node it came from
                    opposite_wp[0].gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Down", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else
                {
                    wp_head_node.connections.Add("Up", opposite_wp[0].gameObject);
                    //assign to the next node the node it came from
                    opposite_wp[0].gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Up", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
            }
            else if (Mathf.Abs(wp.transform.position.x) > (toroidal_east_west - wp_overlap))
            {
                Debug.Log("hitns");
                NodeBehaviour wp_head_node = wp.GetComponent <NodeBehaviour>();
                wp_head_node.set_x_warp(true);
                Collider[] opposite_wp = Physics.OverlapSphere(
                    new Vector3(
                        -wp.transform.position.x,
                        wp.transform.position.y,
                        wp.transform.position.z),
                    wp_overlap / 2,
                    1 << 10 | 1 << 11
                    );
                if (wp.transform.position.x < 0)
                {
                    wp_head_node.connections.Add("Left", opposite_wp[0].gameObject);
                    //assign to the next node the node it came from
                    opposite_wp[0].gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Left", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else
                {
                    wp_head_node.connections.Add("Right", opposite_wp[0].gameObject);
                    //assign to the next node the node it came from
                    opposite_wp[0].gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Right", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
            }
            foreach (Collider wp_connection in wp_connections)
            {
                NodeBehaviour wp_head_node = wp.GetComponent <NodeBehaviour>();
                if (Mathf.Floor(wp_connection.gameObject.transform.position.z / wp_overlap) < Mathf.Floor(wp.gameObject.transform.position.z / wp_overlap))
                {
                    wp_head_node.connections.Add("Down", wp_connection.gameObject);
                    //assign to the next node the node it came from
                    wp_connection.gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Down", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else if (Mathf.Floor(wp_connection.gameObject.transform.position.z / wp_overlap) > Mathf.Floor(wp.gameObject.transform.position.z / wp_overlap))
                {
                    wp_head_node.connections.Add("Up", wp_connection.gameObject);
                    //assign to the next node the node it came from
                    wp_connection.gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Up", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else if (Mathf.Floor(wp_connection.gameObject.transform.position.x / wp_overlap) < Mathf.Floor(wp.gameObject.transform.position.x / wp_overlap))
                {
                    wp_head_node.connections.Add("Left", wp_connection.gameObject);
                    //assign to the next node the node it came from
                    wp_connection.gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Left", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else if (Mathf.Floor(wp_connection.gameObject.transform.position.x / wp_overlap) > Mathf.Floor(wp.gameObject.transform.position.x / wp_overlap))
                {
                    wp_head_node.connections.Add("Right", wp_connection.gameObject);
                    //assign to the next node the node it came from
                    wp_connection.gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("Right", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
                else if (wp_connection.gameObject != wp)
                {
                    wp_head_node.connections.Add("?", wp_connection.gameObject);
                    //assign to the next node the node it came from
                    wp_connection.gameObject.GetComponent <NodeBehaviour>().npc_paths_container.Add("?", new NodeBehaviour.PastPathProperties(1.0f, wp_head_node));
                }
            }
        }
    }
 public void Setup()
 {
     MapInfo.InputFileContent = MapSetup.SetupInputContent();
     MapInfo.Map         = MapSetup.SetupMapExampleTest();
     MapInfo.Adventurers = MapSetup.SetupAdventurers();
 }
 void Awake()
 {
     rBody = GetComponent <Rigidbody2D>();
     map   = transform.parent.GetComponentInChildren <MapSetup>();
 }
 public MapTransformationTests()
 {
     Transformer = new MapTransformer();
     MapSetup    = new MapSetup();
 }
 // Use this for initialization
 void Start()
 {
     mapSetupUI = BotPanelObject.GetComponent<MapSetup>();
 }
 public void Start()
 {
     boardManager = GameObject.Find("Manager").GetComponent<BoardManager>();
     mapSetupUI = GameObject.Find("Main Camera").transform.Find("UI Root (3D)").Find("Bottom Panel").GetComponent<MapSetup>();
 }