示例#1
0
    // Use this for initialization
    public void Init(string system, string planetName, int radius, MiniMap minimap)
    {
        this.outline    = this.gameObject.GetComponent <Outline>();
        this.myCollider = this.gameObject.GetComponent <Collider>();
        this.myRenderer = this.gameObject.GetComponent <Renderer>();
        this.radius     = radius;
        this.angle      = Mathf.Asin(this.gameObject.transform.position.x / radius);
        this.speed      = (2 * Mathf.PI) / Random.Range(radius * 2, radius * 5);


        if (PlayerPrefs.HasKey(system + "." + planetName))
        {
            this.isMined = PlayerPrefs.GetInt(system + "." + planetName, 0) == 1;
        }
        else
        {
            PlayerPrefs.SetInt(system + "." + planetName, 0);
        }

        if (this.isMined)
        {
            this.myCollider.enabled        = false;
            this.outline.color             = 2;
            this.myRenderer.sharedMaterial = disabledState;
        }

        this.planetName = planetName;

        this.minimapObj = minimap.InitPlanet(this.gameObject, this.isMined);
        this.minimap    = minimap;
    }