Esempio n. 1
0
    private void SpawnPlanetoid(PlanetoidType type, Vector3 position, float drag, float size)
    {
        GameObject ob = (type == PlanetoidType.HOSTILE) ?
                        Instantiate(Resources.Load("Prefabs/Ship") as GameObject) :
                        Instantiate(Resources.Load("Prefabs/Dino") as GameObject);

        ob.name = (type == PlanetoidType.HOSTILE) ? "ship" : "dino";
        ob.transform.SetParent(Application.Instance.WorldParent);
        ob.transform.position = position;

        if (ob != null)
        {
            Planetoid p = ob.GetComponentInChildren <Planetoid>();
            p.Manager = this;
            p.MultiplyDrag(drag);
            p.MultiplySize(size);

            planetoids.Add(p);
        }
    }