コード例 #1
0
        // Use this for initialization
        void Awake()
        {
            Debug.Log("<color=cyan>START GAME</color>");

            if (startText == null) Debug.LogError("No <color=cyan>startText</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (screen1 == null) Debug.LogError("No <color=cyan>screen1</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (screen2 == null) Debug.LogError("No <color=cyan>screen2</color> assigned to:<color=cyan>"+gameObject.name+"</color>");

            UIManager ui = UIManager.Instance;
            UIManager.ScreenChanged = notifyScreenChanged;

            ui.AddScreen(screen1);
            ui.AddScreen(screen2);
            ui.ActivateScreen(screen1.name);

            startText.SetActive(false);

            //localisation
            i18nManager = I18nManager.Instance;
            i18nManager.SetLanguage(lang);

            //add an empty main game
            GMGame game = new GMGame("TestGame");
            gm = GameManager.Instance;

            ACondition falseCond = new FalseCondition();
            ACondition trueCond = new TrueCondition();

            ACondition relTimeCond = new TimerCondition(TimerType.Absolute, 8, game.TimeSource);  //true after 1sec
            //this will only be fired, when both fireCondition is true at the same time
            ScriptTrigger<string> trigger3 = new ScriptTrigger<string>();
            trigger3.Value = "TestGame";
            trigger3.Function = TestScriptFunctionString;
            trigger3.Priority = 1;
            trigger3.Repeat = 1;							//only fire once
            trigger3.FireCondition += trueCond.Check;		//always true, but you can check sg extra here
            trigger3.FireCondition += relTimeCond.Check;	//should fire only when time reached
            trigger3.DeleteCondition = falseCond.Check;		//don't remove until repeating
            gm.Add (game);
            game.AddTrigger(trigger3);
            Debug.Log (" ----> AddTrigger 3");
            gm.Start(game.Name);
        }
        }//TestScriptConditionEvaulateBool()
        
        
//------------------------------------------------------------------------------
        
        // Use this for initialization
        public void Awake()
        {
            Debug.Log ("AquaSphereMini awake.");
            WebPlayerDebugManager.addOutput ("Version build: " + buildTime, 1);
            dbModuleManager = DBModuleManager.Instance;
            if(useDBModule)
                StartCoroutine("addServiceURL");
            
            base.Awake();
            
            //------- TODO WORKAROUND -------
            GameScenario gs = GameScenario.Instance;
            gs.currentDate = System.DateTime.Now;
            
            //Edit StartPoint
            System.DateTime startDate = GameScenario.Instance.currentDate;
            //WebPlayerDebugManager.addOutput(
            // "Get Current Date: " + startDate, 3);
            startDate = startDate.AddDays (-28);


            Log.Info("Starting AquaSphereMini...");
            
            //create conditions
            ACondition falseCond = new FalseCondition();
            ACondition trueCond  = new TrueCondition();
            ScriptCondition<bool> scriptCond =
                new ScriptCondition<bool>(
                    TestScriptConditionEvaulateBool, true);
        }
コード例 #3
0
        //------------------------------------------------------------------------------
        // Use this for initialization
        public void Awake()
        {
            WebPlayerDebugManager.addOutput ("Version build: " + buildTime, 1);
            dbModuleManager = DBModuleManager.Instance;
            if(useDBModule)
                StartCoroutine("addServiceURL");

            //Debug.Log ("TWISTGame Awake");

            base.Awake();

            //------- TODO WORKAROUND -------
            GameScenario gs = GameScenario.Instance;
            gs.currentDate = System.DateTime.Now;

            //Edit StartPoint
            System.DateTime startDate = GameScenario.Instance.currentDate;
            //WebPlayerDebugManager.addOutput("Get Current Date: " + startDate, 3);
            startDate = startDate.AddDays (-28);
            string text;
            text = i18n.Get("CP1_2_2", "004").Replace(
                "15.3.2014",
                startDate.Day + "." + startDate.Month + "." + startDate.Year
                );
            i18n.Set("CP1_2_2", "004", text);

            //Edit EndPoint
            startDate = GameScenario.Instance.currentDate;
            startDate = startDate.AddDays (14);
            text = i18n.Get ("CP1_2_2", "004").Replace(
                "1.5.2014",
                startDate.Day + "." + startDate.Month + "." + startDate.Year
                );
            i18n.Set ("CP1_2_2", "004", text);
            text = i18n.Get ("CP1_5_5", "001").Replace(
                "1.5.2014",
                startDate.Day + "." + startDate.Month + "." + startDate.Year
                );
            i18n.Set ("CP1_5_5", "001", text);
            text = i18n.Get ("CP1_6_1", "001").Replace(
                "1.5.2014",
                startDate.Day + "." + startDate.Month + "." + startDate.Year
                );
            i18n.Set ("CP1_6_1", "001", text);

            //SIMMode = false;
            //TWISTMode = true;
            SIMMode = SIM;
            TWISTMode = TWIST;
            SIMOptions = ActivateSimOptions;

            //------- /WORKAROUND -------

            Log.Info("Starting TWISTBueBe...");

            // We have two sub game games to the main game
            GMGameCP gameCP = new GMGameCP("CP");
            gm.Add(gameCP);

            GMGameSIM gameSIM = new GMGameSIM("SIM");
            gm.Add(gameSIM);
            /*GameObject objSIM = UIManager.Instance.GetHud("TimeLineSIM");
            goSIM = objSIM.GetComponent<TimeLine>();

            /*gm.Start ("CP");
            gm.Get("CP").Pause();*/
            //gm.Start ("SIM");
            //gm.Get("SIM").Pause();
            //gm.Start ("CP");

            /*
            // get the view object
            GameObject objCP = UIManager.Instance.GetHud("TimeLineCP");
            goCP = objCP.GetComponent<TimeLine>();
            */

            //create conditions
            ACondition falseCond = new FalseCondition();
            ACondition trueCond  = new TrueCondition();
            ScriptCondition<bool> scriptCond =
                new ScriptCondition<bool>(
                    TestScriptConditionEvaulateBool, true);

            //Log.Info("Number of screens:"+ui.NumberOfScreens);
            //Log.Assert(ui.NumberOfScreens > 0,
            //	"No screen found! Did you tag any screen as UIScreen?");

            // Log.Assert(startScreen,
            //            "Missing start screen: '"
            //            +startScreenName+"' for "
            //            +gameObject.name);
            // //ui.ActivateScreen(startScreenName);
            // //startScreen.SetActive(true);
        }