示例#1
0
 // This method initializes the galaxy by setting seed number, creating a new dictionary, setting galaxy view to true and setting star count to 0
 void InitializeGalaxy()
 {
     starToObjectMap = new Dictionary <Star, GameObject>();
     Random.InitState(seedNumber);
     galaxyView         = true;
     starCount          = 0;
     availableStarNames = TextAssetManager.TextToList(starNames);
 }
示例#2
0
 //         Attack          Dead          Hit           Chuong           Run           Stand           Walk
 // quyen   0               7             18            24               29            35              39
 void Awake()
 {
     instance = this;
     dictBody.Add(3759, SetAnimAsset(TextAssetInfo.body.text, 3759));
     dictHandleft.Add(6021, SetAnimAsset(TextAssetInfo.handleft.text, 6021));
     dictHandright.Add(7153, SetAnimAsset(TextAssetInfo.handright.text, 7153));
     dictHead.Add(4257, SetAnimAsset(TextAssetInfo.head.text, 4257));
 }
示例#3
0
    public void CreateGalaxy()
    {
        Random.InitState(seedNumber);
        CurrentCourse = SpaceObjects.CreateCoursePath(CoursePathPrefab, this.transform);
        CurrentCourse.SetActive(true);
        if (PathView)
        {
            TogglePathView();
        }
        GalaxyView         = true;
        starToObjectMap    = new Dictionary <Star, GameObject>();
        availableStarNames = TextAssetManager.TextToList(StarNames);
        int failCount = 0;

        for (int i = 0; i < numberOfStars; i++)
        {
            float distance = Random.Range(0, maximumRadius);
            float angle    = Random.Range(0, 2 * Mathf.PI);
            float altitude = Random.Range(-maximumHeight, maximumHeight) * (1 - distance / maximumRadius);

            var position = new Vector3(distance * Mathf.Cos(angle), altitude, distance * Mathf.Sin(angle));

            var positionCollider = Physics.OverlapSphere(position, mininumProximity);

            if (positionCollider.Length == 0)
            {
                var name           = availableStarNames[i];
                var starData       = new Star(name, Random.Range(0, maximumPlanets), Random.Range(3f, 6f), i % SpaceObjects.StarColors.Length, i % 10);
                var starGameObject = SpaceObjects.CreateSphereObject(starData.StarName, position, _defaultStarSize, this.transform);

                starGameObject.GetComponent <Renderer>().material.color = SpaceObjects.StarColors[starData.ColorIndex];

                starToObjectMap.Add(starData, starGameObject);
                CreatePlanetData(starData);

                failCount = 0;
            }
            else
            {
                failCount++;
                i--;
            }
            if (failCount > numberOfStars)
            {
                Debug.Log("Failed to generate star due to proximity validation check");
                break;
            }
        }
        pathViewButton.interactable = true;
        CurrentCourse.SetActive(false);
    }
示例#4
0
 void Awake()
 {
     instance         = this;
     TextAssetManager = transform.GetComponent <TextAssetManager>();
 }