Пример #1
0
        public void RemoveUnit(GameData.Beacon beacon)
        {
            List <BeaconView> views = new List <BeaconView>(m_ResourceContainer.GetComponentsInChildren <BeaconView>());
            BeaconView        view  = views.Find((v) => v.beacon == beacon);

            Destroy(view.gameObject);
        }
Пример #2
0
        public UnitView AddUnit(GameData.Beacon beacon, Color tint)
        {
            string prefabPath = null;

            switch (beacon.mapID)
            {
            case map_id.Fumarole:           prefabPath = "Resource/Fumarole";                                                                                                                                               break;

            case map_id.MagmaVent:          prefabPath = "Resource/MagmaVent";                                                                                                                                              break;

            case map_id.MiningBeacon:       prefabPath = "Resource/" + beacon.oreType.ToString() + "Beacon" + GetBarYieldSuffix(beacon.barYield);   break;
            }

            if (prefabPath == null)
            {
                return(null);
            }

            GameObject goUnit = CreateUnit(prefabPath, m_ResourceContainer, beacon.id, new Vector2Int(beacon.position.x, beacon.position.y));
            BeaconView view   = goUnit.GetComponent <BeaconView>();

            view.Initialize(beacon, tint);
            return(view);
        }