Exemplo n.º 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);
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
    private void Start()
    {
        BuildingPlace buildingPlaceScript = FindObjectOfType <BuildingPlace>();

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

        Factory factoryScript = FindObjectOfType <Factory>();

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