Add() public method

Adds the trigger to the current game. For smoothly "Remove trigger" execute "ATrigger.Repeat = 0;" Because that is a Remove, which can occur within trigger execution. Otherwise you get an error.
public Add ( Epigene.GAME.ATrigger trigger ) : void
trigger Epigene.GAME.ATrigger
return void
コード例 #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);
        }
コード例 #2
0
        // Use this for initialization
        public virtual void Awake()
        {
            Log.Debug("__________________________________ AWAKE _____________________________");

            parameters = new Dictionary<string, string>();

            // if(useDBModule)
            // {
            // 	// StartCoroutine("xmlLoadRoutine");
            // 	LoadAppConfigurationXml();
            // }

            //testParameters instead of document.location.search
            // for testing Web Player: Variables in PHP are
            // $UserName and $SessionToken

            Log.Level = logLevel;
            Log.Info("Starting MainGame ... name "+this.name);

            ui = UIManager.Instance;

            ui.InitUI(gameObject);

            if (!GameManager.Instance.offline)
                GameManager.Instance.offline = offline;
            else
                offline = GameManager.Instance.offline;

            ui.ConfigResources = configResources;
            if(tooltip)
                ui.Tooltip = (UITooltip)Instantiate(tooltip, Vector3.zero, Quaternion.identity);

            //set ui camera to custom 2D camera
            Log.Assert(camera2D != null, "You have to assign a 2D camera in "+gameObject.name);
            UIManager.UICamera = camera2D;

            gm = GameManager.Instance;
            gm.mainGame  = this;
            gm.debugMode = debug;
            gm.standaloneBetaMode = standaloneBeta;
            gm.standaloneSingleLevelMode = standaloneSingleLevel;
            gm.BalanceSheetAchievementMode = true;
            gm.muteSfx = muteSfx;
            if(gm.setTouch)
                gm.hidTouch = hidTouch;
            else
                hidTouch = gm.hidTouch;
            gm.muteSoundBackground = muteSoundBackground;

            //localisation

            i18n = I18nManager.Instance;
            i18n.LoadDbFile(localizatoinDB);

            if(i18n.Language == null || i18n.Language.Length == 0)
            {
                //first time set
                string lang = "";
                switch(language)
                {
                    case Languages.DE:
                        lang = "DE";
                        break;
                    case Languages.DEP:
                        lang = "DEP";
                        break;
                    case Languages.EN:
                        lang = "EN";
                        break;
                    case Languages.NL:
                        lang = "NL";
                        break;
                }

                i18n.Language = lang;
            }
            else
            {
                //lang has already been set,
                //but better to set local game's language to avoid confusion
                switch(i18n.Language)
                {
                    case "DE":
                        language = Languages.DE;
                        break;
                    case "DEP":
                        language = Languages.DEP;
                        break;
                    case "EN":
                        language = Languages.EN;
                        break;
                    case "NL":
                        language = Languages.NL;
                        break;
                }

                I18nManager.Instance.SetLanguage(i18n.Language);
            }

            //Audio using localization db
            am = AudioManager.Instance;
            am.InitAudio();
            try
            {
                // Log.Debug("---------- am:"+am);
                Log.Debug("---------- audioResources:"+audioResources);
                am.LoadResources("AUDIO", audioResources);
                am.MuteMusic = muteSoundBackground;
                am.MuteSfx = muteSfx;
            }
            catch
            {
                //TODO only hide when in editor mode
                //we hide error for now due to editor
                Log.Error("---------- audioResources:"+audioResources);
            }

            // DialogGame can be seen as a MainGame and a requirement
            GMGame game = new GMGame(this.name);
            gm.Add(game);
            gm.DialogGame = game;
        }
コード例 #3
0
    /// <summary>
    /// Start this instance.
    /// </summary> 
    public void Start()
    {
        Debug.Log("Start TestGame");

        //create games
        GMGame game1 = CreateGame1();
        GMGame game2 = CreateGame2();

        //create gamemanager
        gameManager = GameManager.Instance;

        //add games to manager
        gameManager.Add(game1);
        gameManager.Add(game2);
        gameManager.Start(game1.Name);
    }