Beispiel #1
0
        public BaseObjType CreateObject(FactoryType tType)
        {
            BaseObjType Ret = default(BaseObjType);
            CBaseTypeObjectFactoryUnit <BaseObjType, FactoryType> FactoryUnit;

            if (m_FactoryDict.TryGetValue(tType, out FactoryUnit))
            {
                Ret = FactoryUnit.createObject();
            }
            return(Ret);
        }
        public override StarUnit FactoryMethod(FactoryUnit type)
        {
            switch (type)
            {
            case FactoryUnit.TANK:
                return(new Tank());

            case FactoryUnit.VURTURE:
                return(new Vurture());

            default:
                throw new System.Exception();
            }
        }
    private void Start()
    {
        BuildingPlace buildingPlaceScript = FindObjectOfType <BuildingPlace>();

        if (buildingPlaceScript != null)
        {
            onCallPreviewBuilding += buildingPlaceScript.AttachPreviewToCursor;
        }

        Factory factoryScript = FindObjectOfType <Factory>();

        if (factoryScript != null)
        {
            onCallCreateUnit += factoryScript.CreateUnit;
        }
    }
 public abstract StarUnit FactoryMethod(FactoryUnit type);
Beispiel #5
0
 public void Save(FactoryUnit factoryUnit)
 {
     _context.Database.ExecuteSqlRaw(
         $"dbo.SaveFactoryUnit {factoryUnit.ControllerId}, {factoryUnit.CategoryId}, {factoryUnit.FactoryId}");
     _context.SaveChanges();
 }
Beispiel #6
0
 public void Post([FromBody] FactoryUnit factoryUnit)
 {
     _service.Save(factoryUnit);
 }