Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("--- Command Pattern ---");
            StockTradeClient stc = new StockTradeClient();

            stc.Run();

            Console.WriteLine("\n--- Composite Pattern ---");
            GraphicsEditor ge = new GraphicsEditor();

            ge.Run();

            Console.WriteLine("\n--- Decorator Pattern ---");
            GUIDriver gd = new GUIDriver();

            gd.Run();

            Console.WriteLine("\n--- Factory Pattern ---");
            DocClient dc = new DocClient();

            dc.Run();

            Console.WriteLine("\n--- Mediator Pattern ---");
            ChatClient cc = new ChatClient();

            cc.Run();

            Console.WriteLine("\n--- Observer Pattern ---");
            NewsClient nc = new NewsClient();

            nc.Run();

            Console.ReadLine();
        }
Пример #2
0
    //Initilize
    public void Initialize(
        STDMath math, Generator gen, Assets asset, SelectionScript selec,
        bool active, bool defense, bool ai
        )
    {
        //assign external variables
        map         = gen;
        assetHolder = asset;
        selector    = selec;
        stdMath     = math;
        Random.InitState(stdMath.seed);
        guiCon = GameObject.Find("UI").GetComponent <GUIDriver> ();

        //Sets living or AI player, and defense or offense
        activePlayer = active;
        isAI         = ai;
        onDefense    = defense;

        //Create overlord upgrades
        upgrades = this.gameObject.AddComponent <OverlordUpgrade>();
        upgrades.Init(active, math, this, gen);



        //initialzies per playertype
        if (active)
        {
            quickKeys          = selec.gameObject.GetComponent <QuickKeys>();
            quickKeys.overlord = this;

            //Initialize Gui
            guiCon.InitGUI(this);

            controls = gen.GetControls();
            controls.Init(math, this, gen);

            //set default unit layer
            defualtLayer        = 11;
            defualtLayerOutline = 29;
        }

        //set GameTime starting
        gameTime = Time.time;
    }