当前位置: 首页>>代码示例>>C#>>正文


C# state类代码示例

本文整理汇总了C#中state的典型用法代码示例。如果您正苦于以下问题:C# state类的具体用法?C# state怎么用?C# state使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


state类属于命名空间,在下文中一共展示了state类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: closestGoodPred

        public state closestGoodPred(state s, bool updateCosts = true)
        {
            //'moves' robot's logical position to the closest NOT-dead-end node to s out of S's predecessors. Required to avoid massive recalculations on mapping own position's cost to infinity.
            List<state> preds = new List<state>();
            Dictionary<state, state> succ = new Dictionary<state, state>();
            preds.Add(s);
            state cur = s;
            while (isDeadEnd(cur))
            {
                foreach (state ss in predecessors(cur))
                {
                    preds.Add(ss);
                    if(!succ.ContainsKey(ss))succ.Add(ss, cur);
                }
                cur = preds[0];
                preds.Remove(cur);

            }
            state ini = cur;
            while (equals(ini , s) && false)
            {
                //setCost(ini, costs[ini.x,ini.y]);
                ini = succ[ini];
            }
            return cur;
        }
开发者ID:justheuristic,项目名称:GraveRobot,代码行数:26,代码来源:Problem.cs

示例2: getAccountInfo

 bool getAccountInfo(string[] parts, state reason)
 {
     if (parts [0].Replace (" ", "").Equals ("") || parts [1].Replace (" ", "").Equals ("") || parts [2].Replace (" ", "").Equals ("")) {
         Debug.Log("Error!");
         if (reason == state.login){
             return false;
         } else
             return true;
     }
     if (reason == state.register) {
         if (!parts [2].Contains ("@")) {
             Debug.Log ("Invalid Email");
             return true;
         }
         foreach(String s in invalidPassChars){
             if (parts [1].Contains (s)) {
                 Debug.Log ("Invalid characters in password");
                 return true;
             }
         }
         foreach(String s in invalidUserChars){
             if (parts [0].Contains (s)) {
                 Debug.Log ("Invalid characters in username");
                 return true;
             }
         }
     }
     if (reason == state.login && parts [0].Replace(" ", "`").ToLower().Equals (loginUser.text.Replace(" ", "`").ToLower()) && parts [1].Equals (loginPass.text)) {
         return true;
     }
     if (reason == state.register && parts [0].Equals (username.text)) {
         return true;
     }
     return false;
 }
开发者ID:KingCrazy,项目名称:gameCreator,代码行数:35,代码来源:registerAccount.cs

示例3: ChangeAIStateDelay

 //couroutine change AI state with a delay time
 IEnumerator ChangeAIStateDelay(state currstate, float time)
 {
     yield return new WaitForSeconds(time);
     currState = currstate;
     //shootCheck = false;
     StopCoroutine("ChangeAIStateDelay");
 }
开发者ID:lamweilun,项目名称:FINAL_YEAR_PROJECT_MAJOR_CNB,代码行数:8,代码来源:BossBehaviour.cs

示例4: LateUpdate

	void LateUpdate()
	{
		if (target != null)
		{
			if (panState == state.pantoward)
			{
				player.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
				camPos = Vector3.SmoothDamp(camPos, new Vector3(target.transform.position.x, target.transform.position.y, camPos.z), ref currentVelocity, panTime);
				Camera.main.transform.position = camPos;
				Debug.Log(currentVelocity);
				if (Vector2.Distance(camPos, target.transform.position) < 0.1f)
				{
					Invoke("startPanBack", stayTime);
					panState = state.panwait;
				}
			}
			else if (panState == state.panback)
			{
				camPos = Vector3.SmoothDamp(camPos, new Vector3(player.position.x, player.position.y, camPos.z), ref currentVelocity, panTime);
				Camera.main.transform.position = camPos;
				if (Vector2.Distance(camPos, player.position) < 0.1f)
				{
					Camera.main.GetComponent<CameraController>().enabled = true;
					panState = state.notpanning;
				}
			}
		}
	}
开发者ID:technicalvgda,项目名称:Adagio,代码行数:28,代码来源:PanButton.cs

示例5: button16_Click

 // Кнопка "=" - считает результат по тому статусу, который выполняется
 private void button16_Click(object sender, EventArgs e)
 {
     try
     {
         // если текущий статус деление
         if (CurrentState == state.divide)
         {
             CurrentState = state.nonstate;
             double buff2 = double.Parse(textBox1.Text);
             textBox1.Text = (double.Parse(buff) / buff2).ToString();
         }                // если текущий статус умножение
         if (CurrentState == state.multiplication)
         {
             CurrentState = state.nonstate;
             double buff2 = double.Parse(textBox1.Text);
             textBox1.Text = (double.Parse(buff) * buff2).ToString();
         }                // если текущий статус деление
         if (CurrentState == state.substraction)
         {
             CurrentState = state.nonstate;
             double buff2 = double.Parse(textBox1.Text);
             textBox1.Text = (double.Parse(buff) - buff2).ToString();
         }                // если текущий статус добавление
         if (CurrentState == state.addiction)
         {
             CurrentState = state.nonstate;
             double buff2 = double.Parse(textBox1.Text);
             textBox1.Text = (double.Parse(buff) + buff2).ToString();
         }
     }
     catch(Exception)
     {
         MessageBox.Show("Введены некорректные данные");
     }
 }
开发者ID:GarageInc,项目名称:all,代码行数:36,代码来源:Form1.cs

示例6: OnRevolution

    public void OnRevolution()
    {
        if(currentState == state.MOVING){//start a dive if a dive isn't already in progress
            currentState = state.DIVING;
            radii.y = -0.2f;
            radii.z = -diveAcc;
        }

        if(mode >= 1){//gain speed
            if(thetas.y < maxSpeed){
                thetas.y += speedPerRevolution;
                if(thetas.y > maxSpeed)
                    thetas.y = maxSpeed;
            }
        }
        if(mode >= 2){//enemies gain speed
            List<Enemy> enemylist = Dial.GetAllEnemies();
            foreach(Enemy e in enemylist){
                GameObject zappything = GameObject.Instantiate(Resources.Load ("Prefabs/MainCanvas/ZappyThing")) as GameObject;
                zappything.GetComponent<RectTransform>().sizeDelta = e.GetComponent<RectTransform>().sizeDelta * 1.7f;
                zappything.GetComponent<Lifespan>().BeginLiving(3f);
                zappything.GetComponent<Lifespan>().SetImageToFade(true);
                zappything.transform.SetParent(e.transform,false);

                e.SpeedUp(enemyBoostMultiplier,enemyBoostDuration);
            }
        }
        if(mode >= 3){//gain life drain
            lifeDrain += lifeDrainPerRevolution;
        }
    }
开发者ID:Benedict-SC,项目名称:doom-dial,代码行数:31,代码来源:Skizzard.cs

示例7: runStates

    void runStates()
    {
        switch (currentState)
        {
            case state.idle:
                rigid.velocity = Vector3.zero;
                float dist = Vector3.Distance(transform.position, PlayerCharacter.instance.transform.position);
                if (dist < triggerDistance)
                {
                    currentState = state.shooting;
                }
                break;
            case state.shooting:
                shootPlayer();
                float currentDist = Vector3.Distance(transform.position, PlayerCharacter.instance.transform.position);
                if (currentDist > triggerDistance)
                {
                    currentState = state.idle;
                }
                break;
            case state.knockback:
                knockback();
                if (!inKnockback)
                {
                    currentState = state.idle;
                }
                break;
        }

        if (inKnockback)
        {
            currentState = state.knockback;
        }
    }
开发者ID:interwebsninja,项目名称:eviscerate,代码行数:34,代码来源:laserEnemy.cs

示例8: createModuleContainer

    public void createModuleContainer()
    {
        this.transform.gameObject.GetComponent<ModuleContainer>().show();
        show_interface = state.Module;

        disableCamera();
    }
开发者ID:kretzmoritz,项目名称:Archive,代码行数:7,代码来源:CreateInterface.cs

示例9: destroyDialog

    public void destroyDialog()
    {
        this.transform.gameObject.GetComponent<CreateDialog>().hide();
        show_interface = state.Clear;

        enableCamera();
    }
开发者ID:kretzmoritz,项目名称:Archive,代码行数:7,代码来源:CreateInterface.cs

示例10: changestate

 public void changestate(state newstate)
 {
     if(currentState != null)
         currentState.Exit();
     currentState = newstate;
     currentState.Enter(this);   
 }
开发者ID:new-00-0ne,项目名称:System-Purge,代码行数:7,代码来源:Enemy.cs

示例11: createDialog

    public void createDialog()
    {
        this.transform.gameObject.GetComponent<CreateDialog>().show();
        show_interface = state.Dialog;

        disableCamera();
    }
开发者ID:kretzmoritz,项目名称:Archive,代码行数:7,代码来源:CreateInterface.cs

示例12: LoadReceived

    public void LoadReceived()
    {
        received_state = state.LOADING;
        received.Clear();
        string url = SocialManager.Instance.FIREBASE + "/challenges.json";
            //?orderBy=\"time\"&limitToLast=30";
        url += "?orderBy=\"op_facebookID\"&equalTo=\"" + SocialManager.Instance.userData.facebookID + "\"";
        Debug.Log("LoadReceived: " + url);
        HTTP.Request someRequest = new HTTP.Request("get", url);
        someRequest.Send((request) =>
        {
            Hashtable decoded = (Hashtable)JSON.JsonDecode(request.response.Text);
            if (decoded == null)
            {
                Debug.LogError("server returned null or     malformed response ):");
                return;
            }

            foreach (DictionaryEntry json in decoded)
            {
                Hashtable jsonObj = (Hashtable)json.Value;
                PlayerData newData = new PlayerData();
                newData.objectID = (string)json.Key;
                newData.facebookID = (string)jsonObj["facebookID"];
                newData.playerName = (string)jsonObj["playerName"];
                newData.score = (int)jsonObj["score"];
                newData.score2 = (int)jsonObj["score2"];
                newData.winner = (string)jsonObj["winner"];
                newData.notificated = (bool)jsonObj["notificated"];
                received.Add(newData);
            }
            received_state = state.READY;
        });
    }
开发者ID:pontura,项目名称:PungaRaid,代码行数:34,代码来源:ChallengersManager.cs

示例13: play

 public void play()
 {
     MainWindow1.Title = System.IO.Path.GetFileNameWithoutExtension(med.chemin[i]);
     mediaElement.Play();
     play_state = state.play;
     play_button.Content = WebUtility.HtmlDecode("&#xE769;");
 }
开发者ID:Sephiroth25896,项目名称:Projects,代码行数:7,代码来源:MainWindow.xaml.cs

示例14: runStates

    void runStates()
    {
        switch(currentState)
        {
            case state.idle:
                float dist = Vector3.Distance(transform.position, PlayerCharacter.instance.transform.position);
                if(dist < triggerDistance)
                {
                    currentState = state.following;
                }
                break;
            case state.following:
                followPlayer();
                break;
            case state.knockback:
                knockback();
                if (!inKnockback)
                {
                    currentState = state.idle;
                }
                break;
        }

        if (inKnockback)
        {
            currentState = state.knockback;
        }
    }
开发者ID:interwebsninja,项目名称:eviscerate,代码行数:28,代码来源:blobEnemy.cs

示例15: Dialog

        public Dialog(Point Position, Size Size, string Caption = "", string Text = "", int Depth = 0, state Type = state.message, Form1 f = null)
        {
            this.Position = Position;
            this.Size = Size;
            this.Caption = Caption;
            this.Text = Text;
            this.Depth = Depth;
            this.Type = Type;

            nextDialog = null;
            Id = Globalization.setId();
            DialogueStart = false;
            nextDialogID = -1;
            Rotation = 0;
            nextDialogBranch = null;
            nextDialogBranchId = -1;
            nextConditionDialog = null;
            nextActionDialog = null;
            messageAttachedWire = -1;
            startPosition = Position;
            startPositionUnzoomed = Position;
            Rotation = 0;

            Update(f);
        }
开发者ID:lofcz,项目名称:SimplexRpgEngine,代码行数:25,代码来源:Dialog.cs


注:本文中的state类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。