Inheritance: MonoBehaviour
示例#1
0
文件: IA_paraTutu.cs 项目: fayvit/PQP
    protected override int proximoGolpe()
    {
        int retorno = 0;
        switch(numeroDeGolpes)
        {
        case 5:
            retorno = 0;
        break;
        case 7:
            this.enabled = false;
            tuto = Camera.main.GetComponent<Tutorial>();
            paraMovimento();
            tuto.EnsineAUsarMaca();
            retorno  = 1;
        break;
        case 12:
            print("Cade o use a energia de garras");
            tuto.useAEnergiaDeGarras();
            retorno = 1;
            paraMovimento();
            this.enabled = false;

        break;
        default:
            retorno = 1;
        break;
        }
        print(numeroDeGolpes);
        return retorno;
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     control = (Control)FindObjectOfType(typeof(Control));
     grid = (Grid)FindObjectOfType(typeof(Grid));
     buttonRow =  new TutorialButtonRow(control);
     tutorial = (Tutorial)FindObjectOfType(typeof(Tutorial));
 }
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Tutorial.AddressBook Deserialize(Stream stream, Tutorial.AddressBook instance)
        {
            if (instance.Person == null)
                instance.Person = new List<Tutorial.Person>();
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        // repeated
                        instance.Person.Add(Tutorial.Person.DeserializeLengthDelimited(stream));
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
    void Awake()
    {
        languageMgr = GameObject.FindObjectOfType<LanguageManager>();
        tutorial = GameObject.FindObjectOfType<Tutorial>();

        riseEndY = transform.position.y + moveDistance / 2;
        fallEndY = transform.position.y - moveDistance / 2;


    }
示例#5
0
        public void Parse_ForAllFoundTutorials_Succeeds(Tutorial tutorial)
        {
            var grammar  = new PegParser().Parse(tutorial.GrammarText);
            var compiled = PegCompiler.Compile(grammar);
            var parser   = CodeCompiler.Compile <object>(compiled);

            var result = parser.Parse(tutorial.TestText);

            Assert.That(result, Is.Not.Null);
        }
示例#6
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
         return;
     }
     _instance = this;
     DontDestroyOnLoad(gameObject);
 }
示例#7
0
        public void UpdateTutorialSelection()
        {
            if (isMultiplayer)
            {
                return;
            }
            Tutorial contextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial);

            contextualTutorialBox.Selected = (contextualTutorial != null) ? !GameMain.Config.CompletedTutorialNames.Contains(contextualTutorial.Name) : true;
        }
    private void Awake()
    {
        inst = this;

        PauseScreen = GameObject.Find("PauseScreen");
        SoundObject = GameObject.Find("SoundStatus");
        WinPlane    = GameObject.Find("WinPlane").GetComponent <Image>();
        LostPlane   = GameObject.Find("LostPlane").GetComponent <Image>();

        SoundOnOff();
    }
示例#9
0
    private Color textCol;                      // Dark color of themeManager

    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
示例#10
0
 void RemoveEventHandle(Tutorial tutorial)
 {
     foreach (TutorialInfo info in tutorial.tutorials)
     {
         Tutorial t = GetTutorialList(info.eventID);
         if (t == null)
         {
             CEventSystem.Instance.UnRegistEventHandle(info.eventID, OnEvent);
         }
     }
 }
示例#11
0
    // Start is called before the first frame update
    private void Awake()
    {
        Application.targetFrameRate = 300;


        if (tutorial)
        {
            Destroy(gameObject);
        }
        tutorial = this;
    }
示例#12
0
    #pragma warning restore 0649

    void Start()
    {
        rigidbody         = GetComponent <Rigidbody>();
        velocityEstimator = GetComponent <Valve.VR.InteractionSystem.VelocityEstimator>();
        audioSource       = GetComponent <AudioSource>();
        if (Tutorial.IsTutorial())
        {
            Tutorial.PlayFrisbeePrompt();
            introScene = true;
        }
    }
        public void Save([FromBody] Tutorial tutorial)
        {
            IsUserInSession();
            IsAuthorized();
            //var path = Path.Combine(Server.MapPath("~/uploads"), tutorial.FullFilePath);

            var path = "/uploads/" + tutorial.FullFilePath;

            tutorial.FullFilePath = path;
            _tutorialFacade.SaveTutorial(tutorial);
        }
示例#14
0
 bool HasSameTypeActions(Tutorial tut, TutorialAction ac)
 {
     for (var i =0; i < tut.EventActions.Count; i++)
     {
         if (tut.EventActions[i].Event == ac.Event & tut.EventActions[i] != ac)
         {
             return true;
         }
     }
     return false;
 }
示例#15
0
 void Awake()
 {
     if (control == null)
     {
         control = this;
     }
     else if (control != this)
     {
         Object.Destroy(this.gameObject);
     }
 }
示例#16
0
    public void ActivateTutorial(Tutorial tut, float timeSet)
    {
        Debug.Log(tut.num);
        TutText.text   = tut.tutText.Replace("$", "\n");
        activeTutorial = tut;
        TutText.gameObject.SetActive(true);

        tutorialBG.gameObject.SetActive(true);

        timer = timeSet;
    }
    private void Awake()
    {
        environmentSpawnerScript = this.gameObject.GetComponent<LevelEnvironmentSpawner>();
        slideSpawnScript = this.gameObject.GetComponent<SlideSpawner>();
        levelSegSelect = this.gameObject.GetComponent<LevelSegmentSelection>();
        tutorialScript = this.gameObject.GetComponent<Tutorial>();

        //LoadTextAssets for ObjectSegments
        LoadTextAssets();
        MakeInstance();
    }
        public async Task <IActionResult> Create([Bind("ID,Name,Description,Price,StartDate")] Tutorial tutorial)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tutorial);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tutorial));
        }
    public void SetNextTutorial(int currentOrder)
    {
        currentTutorial = GetTutorialByOrder(currentOrder);

        if (!currentTutorial)
        {
            CompletedAllTutorials();
            return;
        }
        expText.text = currentTutorial.Explanation;
    }
示例#20
0
    public IEnumerator Play()
    {
        camCon.enabled = false;
        //pause game
        Time.timeScale = 0.0f;

        for (int i = 0; i < dialogs.Length; i++)
        {
            if (skip_intro)
            {
                skip_intro = false;
                skip_intro_button.SetActive(false);
                break;
            }
            dialogs[i].SetActive(true);
            skip_intro_button.SetActive(true);

            while (dialogs[i].activeSelf)
            {
                if (skip_intro)
                {
                    dialogs[i].SetActive(false);
                    break;
                }
                yield return(new WaitForSecondsRealtime(0.1f));
            }
        }

        // Clear out any lingering dialog
        for (int i = 0; i < dialogs.Length; i++)
        {
            var reader = dialogs[i].GetComponentInChildren <DialogReader>();
            if (reader)
            {
                reader.Clear();
            }
        }

        title.SetActive(true);
        skip_intro_button.SetActive(false);

        camCon.enabled = true;

        for (float f = 0.0f; f < 0.5f; f += Time.unscaledDeltaTime * camerazoom_out_speed)
        {
            camCon.UpdateZoom(f);
            yield return(new WaitForSecondsRealtime(0.01f));
        }

        //unpause
        Time.timeScale = 1.0f;

        Tutorial.GetOrCreateInstance().ShowStartingTutorial();
    }
示例#21
0
        public void Parse_For05Calculator_ReturnsCorrectValueForMathematicalExpressions(string expression, double value)
        {
            var tutorial = Tutorial.FindAll().Single(t => t.Name == "05 - Calculator");
            var grammar  = new PegParser().Parse(tutorial.GrammarText);
            var compiled = PegCompiler.Compile(grammar);
            var parser   = CodeCompiler.Compile <object>(compiled);

            var result = parser.Parse(expression);

            Assert.That(result, Is.EqualTo(value).Within(0.1).Percent);
        }
示例#22
0
    [HideInInspector] public List <Buddy> students = new List <Buddy>(); //list of all buddies currently learning actions from player

    //Awake is called before Start
    void Awake()
    {
        player       = FindObjectOfType <Player>();
        spawner      = GetComponent <Spawner>();
        ui           = GetComponent <UI>();
        particles    = GetComponent <ParticleManager>();
        cow          = FindObjectOfType <Cow>();
        audioManager = FindObjectOfType <AudioManager>();
        tut          = GetComponent <Tutorial>();
        ui.ToggleTutorial.onValueChanged.AddListener(ToggleTutorial);
    }
示例#23
0
 /// <summary>
 /// This is called on the "update" event of the interface controller.
 /// </summary>
 public override void OnUpdate()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         core.GotoTutorialExit();
     }
     else
     {
         Tutorial.Update();
     }
 }
示例#24
0
        public async Task <Tutorial> UpsertTutorial(Tutorial tutorial)
        {
            await InitializeDatabase();

            var response = await _client.UpsertDocumentAsync(
                _documentCollectionUri,
                tutorial.State,
                disableAutomaticIdGeneration : false);

            return(tutorial);
        }
    public void SetTutorial(Tutorial tutorial)
    {
        tutorialDialogUI.SetActive(true);
        Time.timeScale = 0;
        Cursor.visible = true;

        nextPageButton.onClick.AddListener(NextPage);
        currentTutorial  = tutorial;
        currentPageIndex = 0;
        SwitchToPage(0);
    }
示例#26
0
        protected override void OnTutorialSetup()
        {
            TutorialPage page1 = new TutorialPage("Page1");

            Tutorial.AddPage(page1);
            page1.windowTitle   = "Mission Control";
            page1.OnDrawContent = () =>
            {
                GUILayout.Label("What the---?\nDid that lightning just score a direct hit on the " + FlightGlobals.ActiveVessel.vesselName + "?\nOh no...");
            };

            if (FlightGlobals.ActiveVessel.GetCrewCount() == 0)
            {
                page1.SetAdvanceCondition((KFSMState s) => FlightGlobals.ActiveVessel.missionTime > 18);

                TutorialPage page2 = new TutorialPage("Page2");
                Tutorial.AddPage(page2);
                page2.windowTitle   = "Mission Control";
                page2.OnDrawContent = () =>
                {
                    GUILayout.Label("The controls are all locked up!\nThat lightning took them out!");
                };
                page2.SetAdvanceCondition((KFSMState s) => FlightGlobals.ActiveVessel.missionTime > 22);
            }
            else
            {
                page1.SetAdvanceCondition((KFSMState s) => FlightGlobals.ActiveVessel.missionTime > 22);
            }

            TutorialPage page3 = new TutorialPage("Page3");

            Tutorial.AddPage(page3);
            page3.windowTitle   = "Mission Control";
            page3.OnDrawContent = () =>
            {
                GUILayout.Label("...Hold on, " + FlightGlobals.ActiveVessel.vesselName + ", someone here thinks they have a solution.\n" +
                                "Try \"SCE to AUX\". Supposedly it's on the Obscure Control Panel. Funny, I've never heard of it.");
            };

            TutorialPage page4 = new TutorialPage("Page4");

            Tutorial.AddPage(page4);
            page4.windowTitle   = "Mission Control";
            page4.OnDrawContent = () =>
            {
                GUILayout.BeginVertical();
                GUILayout.Label("That did it!\nThe controls are back!");
                if (GUILayout.Button("Close"))
                {
                    SetDialogRect(new Rect(Screen.width + 100, 0, 0, 0));
                }
                GUILayout.EndVertical();
            };
        }
示例#27
0
    private void OnShowTutorial(EventData e)
    {
        Tutorials tutorial = (Tutorials)e.Data["Tutorial"];

        if (_tutorials.ContainsKey(tutorial))
        {
            Tutorial tutorObj = _tutorials[tutorial];
            AppManager.Instance.Tutorials.SetTutorialShowed(tutorial);
            tutorObj.gameObject.SetActive(true);
        }
    }
        public async Task <ActionResult> Edit([Bind(Include = "id,Title,Desctription,PriceRand,ProfesionalID,DateCreated,PriceCredits")] Tutorial tutorial)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tutorial).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tutorial));
        }
示例#29
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#30
0
        public void Update(int id, Tutorial article)
        {
            var entityToUpdate = this.articles.GetById(id);

            entityToUpdate.Title       = article.Title;
            entityToUpdate.Description = article.Description;
            entityToUpdate.Images      = article.Images;
            entityToUpdate.Type        = article.Type;

            this.articles.Save();
        }
示例#31
0
 private void ThirdStage(bool active = true)
 {
     foreach (GameObject go in thirdStageFire)
     {
         go.SetActive(active);
         if (active == true)
         {
             StartCoroutine(Tutorial.FadeIn(go.GetComponent <SpriteRenderer>(), 1));
         }
     }
 }
        public async Task <IHttpActionResult> GetTutorial(Guid id)
        {
            Tutorial tutorial = await db.Tutorials.FindAsync(id);

            if (tutorial == null)
            {
                return(NotFound());
            }

            return(Ok(tutorial));
        }
    public void popTutorial()
    {
        tutorialStack.Pop();
        Tutorial tutorial = null;

        if (tutorialStack.Count > 0)
        {
            tutorial = tutorialStack.Peek();
        }
        coroutine = StartCoroutine(switchTutorial(tutorial));
    }
示例#34
0
 // Use this for initialization
 void Start()
 {
     //HACK: Made it not add this force when it spawns on the conveyor belt :3
     if (transform.position.z > 0)
     {
         //Spawn the food so it goes in a random direction
         spawnDirection = new Vector3(Random.Range(-1f, 2f), 0, 0);
         GetComponent <Rigidbody>().AddForce(spawnDirection * spawnForce);
     }
     tutorialScript = GameObject.Find("Game").GetComponent <Tutorial>();
 }
 public void Awake()
 {
     tutorialFinished    = new bool[tutorialTexts.Length];
     tutorialFinished[0] = false;
     if (instance != null)
     {
         Debug.LogWarning("Two or more instances of Tutorial in scene.");
         return;
     }
     instance = this;
 }
示例#36
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#37
0
        public IActionResult Create(TutorialEditViewModel model)
        {
            var tutorial = new Tutorial();

            tutorial.Url    = model.Url;
            tutorial.Format = model.Format;

            _tutorialData.Add(tutorial);

            return(RedirectToAction("Details", new { id = tutorial.Id }));
        }
示例#38
0
 private static bool CheckBuild(Tutorial.Chapter chapter)
 {
     if(chapter == Tutorial.Chapter.tutStr){
         return Control.cState.field[6,6] == Route.red &&
             Control.cState.field[5,6] == Route.red;
     }else if(chapter == Tutorial.Chapter.tutDiag){
         return Control.cState.field[1,2] == Route.red &&
             Control.cState.field[1,4] == Route.red;
     }
     Debug.LogError("invalid chapter: "+chapter.ToString());
     return true;
 }
示例#39
0
 public TutorialStorage()
 {
     FullTutorials = new List<Tutorial>();
     Step s = new Step();
     TypeIndexAssociation tia = new TypeIndexAssociation();
     s.Path.Add(tia);
     Tutorial t = new Tutorial();
     t.Steps.Add(s);
     //FullTutorials.Add(new Tutorial("App10", "My Tutorial 1"));
     //FullTutorials.Add(new Tutorial("App11", "My Tutorial 2"));
     //FullTutorials.Add(new Tutorial("App12", "My Tutorial 1"));
     //FullTutorials.Add(new Tutorial("App12", "My Tutorial 2"));
     //FullTutorials.Add(new Tutorial("App13", "My Tutorial 3"));
 }
示例#40
0
 public static bool CheckSolution(Tutorial.Chapter chapter, TowerType tower)
 {
     switch(tower){
     case TowerType.shoot:
         return CheckShoot(chapter);
     case TowerType.build:
         return CheckBuild(chapter);
     case TowerType.silence:
         return CheckSilence(chapter);
     case TowerType.skillCap:
         return CheckSkillCap(chapter);
     default:
         Debug.LogError("Invalid tutorial");
         return false;
     }
 }
示例#41
0
 private static bool CheckSkillCap(Tutorial.Chapter chapter)
 {
     if(chapter == Tutorial.Chapter.tutStr){
         return Control.cState.field[4,3] == Route.destroyed &&
             Control.cState.player[0].playerSkill.build == 2 &&
             Control.cState.player[0].playerSkill.skillCap == 1;
     }else if(chapter == Tutorial.Chapter.tutDiag){
         return Control.cState.field[4,8] == Route.red &&
             Control.cState.field[5,7] == Route.red &&
             Control.cState.field[6,6] == Route.red &&
             Control.cState.field[7,5] == Route.red &&
             Control.cState.field[8,4] == Route.red;
     }
     Debug.LogError("invalid chapter: "+chapter.ToString());
     return true;
 }
示例#42
0
 private static bool CheckSilence(Tutorial.Chapter chapter)
 {
     if(chapter == Tutorial.Chapter.tutStr){
         return (Control.cState.field[5,2] == Route.red ||
              Control.cState.field[5,7] == Route.red)
             &&
             Control.cState.player[1].silenced;
     }else if(chapter == Tutorial.Chapter.tutDiag){
         return (Control.cState.field[0,2] == Route.red ||
              Control.cState.field[5,7] == Route.red)
             &&
             Control.cState.player[1].silenced;
     }
     Debug.LogError("invalid chapter: "+chapter.ToString());
     return true;
 }
示例#43
0
    void Awake()
    {
        
        Screen.SetResolution(1280, 720, true);
        audioSource = GetComponent<AudioSource>();
        sectorMgr = GameObject.FindObjectOfType<SectorManager>();
        uiMgr = GameObject.FindObjectOfType<UIManager>();
        bgmMgr = GameObject.FindObjectOfType<BGMManager>();
        tutorial = GameObject.FindObjectOfType<Tutorial>();
        Application.targetFrameRate = 60;
        line.color = Color.clear;

        isStarsVisible = new bool[stars.Length];
        starsET = new float[stars.Length];

        Ranking.instance.CheckInstance();
    }
示例#44
0
    public void rifleInit()
    {
        squad = GetComponent<TutorialManager>();
        gameLogic = GameObject.Find("GameLogic").GetComponent<Tutorial>();

        squad.size = 5;
        squad.attackDistance = 20;
        squad.movementDistance = 40;
        squad.squadType = "Rifle";

        squad.unitTargets = new Transform[squad.size];

        for (int i = 0; i < squad.size; i++)
        {
            squad.unitTargets[i] = new GameObject().transform;
            squad.unitTargets[i].parent = transform;
            squad.unitTargets[i].localPosition = Quaternion.Euler(0, i * 360 / squad.size, 0) * Vector3.forward * 1.5f;
        }

        GameObject unitPrefab = (GameObject)Resources.Load("Unit");
        if (unitPrefab == null)
            throw new MissingReferenceException("Failed to find Unit Prefab.");

        squad.units = new GameObject[squad.size];
        for (int i = 0; i < squad.size; i++)
        {
            squad.units[i] = (GameObject)Instantiate(unitPrefab, squad.unitTargets[i].position, Quaternion.identity);
            squad.units[i].transform.position = squad.unitTargets[i].position;
            squad.units[i].GetComponent<UnitManager>().power = BalanceConstants.Stats.BASIC_POWER;
        }

        squad.units[squad.units.Length - 1].GetComponent<UnitManager>().power *= 2;
        squad.units[squad.units.Length - 1].GetComponent<UnitManager>().isSpecial = true;
        squad.units[squad.units.Length - 1].transform.localScale = new Vector3(1.25f, 1.25f, 1.25f);

        squad.unitAbility = new TutorialManager.Ability(grenade);
        squad.squadAbility = new TutorialManager.Ability(retreat);
        squad.unitAbilityUpdate = new TutorialManager.AbilityUpdate(grenadeUpdate);
        squad.squadAbilityUpdate = new TutorialManager.AbilityUpdate(retreatUpdate);

        squad.paintColor();
    }
 public virtual void Show(Tutorial tutorial)
 {
     Messenger.Default.Send(new GamePausedMessage());
     Reset();
     gameObject.SetActive(true);
     switch (tutorial)
     {
         case Tutorial.Controls:
             ControlTutorial.alpha = 255;
             break;
         case Tutorial.Red:
             RedTutorial.alpha = 255;
             break;
         case Tutorial.Green:
             GreenTutorial.alpha = 255;
             break;
         case Tutorial.Blue:
             BlueTutorial.alpha = 255;
             break;
     }
 }
示例#46
0
 private static bool CheckShoot(Tutorial.Chapter chapter)
 {
     if(chapter == Tutorial.Chapter.tutStr){
         return Control.cState.field[5,3] == Route.destroyed ||
             Control.cState.field[5,4] == Route.destroyed ||
             Control.cState.field[5,5] == Route.destroyed ||
             Control.cState.field[5,6] == Route.destroyed;
     }else if(chapter == Tutorial.Chapter.tutDiag){
         return (Control.cState.field[7,2] == Route.destroyed ||
             Control.cState.field[6,2] == Route.destroyed ||
             Control.cState.field[5,2] == Route.destroyed ||
             Control.cState.field[4,2] == Route.destroyed)
             &&
             Control.cState.field[5,4] == Route.destroyed ||
             Control.cState.field[5,5] == Route.destroyed ||
             Control.cState.field[5,7] == Route.destroyed ||
             Control.cState.field[5,8] == Route.destroyed;
     }
     Debug.LogError("invalid chapter: "+chapter.ToString());
     return true;
 }
 protected override void Continue()
 {
     Reset();
     switch (_currentTutorial)
     {
         case Tutorial.Controls:
             RedTutorial.alpha = 255;
             _currentTutorial = Tutorial.Red;
             break;
         case Tutorial.Red:
             GreenTutorial.alpha = 255;
             _currentTutorial = Tutorial.Green;
             break;
         case Tutorial.Green:
             BlueTutorial.alpha = 255;
             _currentTutorial = Tutorial.Blue;
             break;
         case Tutorial.Blue:
             Exit();
             break;
     }
 }
示例#48
0
        public int Add(string title, string gameTitle, string content, string creatorId, int? imageId = null)
        {
            var newTutorial = new Tutorial
            {
                Title = title,
                Game = gameTitle,
                Content = content,
                AuthorId = creatorId
            };

            if (imageId != null && imageId != 0)
            {
                newTutorial.ImageId = (int)imageId;
            }
            else
            {
                newTutorial.ImageId = 1;
            }

            this.tutorials.Add(newTutorial);
            this.tutorials.Save();

            return newTutorial.Id;
        }
示例#49
0
 public RefuilingState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new FinalState(context);
 }
示例#50
0
 public SwimJoystickState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new BoostState(context, this);
     defaulControl = context.playerControl.controlType;
 }
示例#51
0
 public SwimJoystickRightState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new SwimAccelerometerUpState(context, this);
     defaulControl = context.playerControl.controlType;
 }
示例#52
0
 public SwimAccelerometerDownState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new BoostState(context, this);
     defaulControl = context.playerControl.controlType;
 }
 /// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
 public static Tutorial.AddressBook Deserialize(byte[] buffer, Tutorial.AddressBook instance)
 {
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
            /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
            public static Tutorial.Person.PhoneNumber DeserializeLengthDelimited(Stream stream, Tutorial.Person.PhoneNumber instance)
            {
                instance.Type = Tutorial.Person.PhoneType.HOME;
                long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
                limit += stream.Position;
                while (true)
                {
                    if (stream.Position >= limit)
                    {
                        if (stream.Position == limit)
                            break;
                        else
                            throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                    }
                    int keyByte = stream.ReadByte();
                    if (keyByte == -1)
                        throw new System.IO.EndOfStreamException();
                    // Optimized reading of known fields with field ID < 16
                    switch (keyByte)
                    {
                        // Field 1 LengthDelimited
                        case 10:
                            instance.Number = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                            continue;
                        // Field 2 Varint
                        case 16:
                            instance.Type = (Tutorial.Person.PhoneType)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                            continue;
                    }

                    var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                    // Reading field ID > 16 and unknown field ID/wire type combinations
                    switch (key.Field)
                    {
                        case 0:
                            throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                        default:
                            global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                            break;
                    }
                }

                return instance;
            }
 public override void Show(Tutorial tutorial)
 {
     base.Show(tutorial);
     _currentTutorial = tutorial;
 }
        /// <summary>Read the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Tutorial.Person DeserializeLength(Stream stream, int length, Tutorial.Person instance)
        {
            if (instance.Phone == null)
                instance.Phone = new List<Tutorial.Person.PhoneNumber>();
            long limit = stream.Position + length;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Name = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.Id = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 3 LengthDelimited
                    case 26:
                        instance.Email = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 4 LengthDelimited
                    case 34:
                        // repeated
                        instance.Phone.Add(Tutorial.Person.PhoneNumber.DeserializeLengthDelimited(stream));
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
示例#57
0
 public HealthState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new RefuilingState(context, this);
 }
 /// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
 public static Tutorial.Person.PhoneNumber Deserialize(byte[] buffer, Tutorial.Person.PhoneNumber instance)
 {
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
示例#59
0
 public FireState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new HealthState(context, this);
 }
示例#60
0
        public PraiseState(Tutorial _context, ChainedState _parent)
            : base(_context)
        {
            parent = _parent;
            startTime = Time.time;

            Rect crosshair = context.crosshairGUI.GetScreenRect();
            float center = crosshair.x + crosshair.width/2;
            const float width = 50;
            rectGood = new Rect(center -  width/2, 120, width, 20);
        }