// Update is called once per frame
    void Update()
    {
        if (currentSeed == null)
        {
            GameObject seedPlaceHolderObject = GameObject.FindGameObjectWithTag("SeedPlaceHolder");
            if (seedPlaceHolderObject != null)
            {
                currentSeed = seedPlaceHolderObject.GetComponent <Text>();
            }
        }

        if (currentSeed != null)
        {
            GameObject mapObject = GameObject.FindGameObjectWithTag("Map");
            if (mapObject != null)
            {
                MapV2 map = mapObject.GetComponent <MapV2>();
                if (map != null)
                {
                    seed             = map.m_mapSeed;
                    currentSeed.text = seed.ToString();
                }
                else
                {
                    Debug.Log("NO MAP");
                }
            }
            else
            {
                Debug.Log("NO MAP OBJECT");
            }
        }
    }
예제 #2
0
 public void GoMap()
 {
     if (!LampBeUse) //&&MapStr!= null)
     {
         MapV2.ClearList();
         gameData._uiTitle = _uiTitle;
         SceneManager.LoadScene(MapStr);
         //SceneManager.LoadScene();
     }
     else
     {
         MapV2.ClearList();
         gameData._uiTitle = UiTitle.BadEnd;
         SceneManager.LoadScene(MapStr);
         // if (MapStr!=null)
         // {
         //     gameData._uiTitle = UiTitle.BadEnd;
         //     SceneManager.LoadScene(MapStr);
         // }
         // else
         // {
         //     SceneManager.LoadScene("m1");
         // }
     }
 }
예제 #3
0
    public void CreateWaypoints()
    {
        Debug.Log("creating waypoints");

        // get necessary variables from Parent:Map
        MapV2 map = gameObject.GetComponentInParent <MapV2>();
        List <PathSegment> pathSegments = map.GetPathSegments();

        // initialize starting point (spawn point for mobs)
        NodeV2     node = map.GetNode(pathSegments[0].start.y, pathSegments[0].start.x);
        GameObject obj  = Instantiate(m_waypoint, node.transform.position + node.GetEnvOffset(), Quaternion.identity) as GameObject;

        obj.name             = "StartingPoint";
        obj.transform.parent = gameObject.transform;
        startTransform       = obj.transform;

        // for each end node of the segment, create a waypoint for mobs to go towards
        for (int i = 0; i < pathSegments.Count; i++)
        {
            node                 = map.GetNode(pathSegments[i].end.y, pathSegments[i].end.x);
            obj                  = Instantiate(m_waypoint, node.transform.position + node.GetEnvOffset(), Quaternion.identity) as GameObject;
            obj.name             = "Waypoint" + (i + 1).ToString();
            obj.transform.parent = gameObject.transform;
            m_waypointList.Add(obj.transform);
        }
    }
예제 #4
0
 public void KillPlayer()
 {
     if (AniLock)
     {
         animator.Play("Gumi_Die2");
     }
     MapV2.ClearList();
     ChangeMap.LampBeUse = false;
 }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        if (nb_controllers > 0 && gameController != null)
        {
            Destroy(gameObject);
            return;
        }
        //DontDestroyOnLoad(gameObject);
        gameController  = GetComponent <GameController>();
        nb_controllers += 1;

        // if no objects attached, find the objects
        if (wallet == null)
        {
            wallet = FindObjectOfType <Wallet>();
        }
        if (health == null)
        {
            health = FindObjectOfType <PlayerHealthController>();
        }
        if (map == null)
        {
            map = FindObjectOfType <MapV2>();
        }

        //GET SEED FROM MENU MANAGER
        MainMenuManagement mmm = FindObjectOfType <MainMenuManagement>();

        if (mmm != null)
        {
            StartGame(mmm.seed);
        }
        else
        {
            StartGame(15243);
        }
    }