Step.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        //Debug.Log (isAnythingPlaying);
        //Checks if player is walking
        if (god.LH != 0.0f || god.LV != 0.0f) {
            //Debug.Log ("Walking, bitch");
            isWalking = true;
            d8old = d8;
            while(d8==d8old){
                d8=Random.Range(0, 7);
            }
            //Debug.Log (d8);
        } else {
            //Debug.Log("Standing still dude");
            isWalking = false;
        }
        isRPlaying = false;
        isMPlaying = false;
        isAPlaying = false;
        isSPlaying = false;
        isPPlaying = false;
        isKPlaying = false;
        isWPlaying = false;
        //Checks if there is a surface beneath the player
        if (isWalking == true && Physics.Raycast (transform.position, -Vector3.up, out hit, 3)) {
            //Debug.Log ("There is a floor beneath me");
            if(/*hit.collider.gameObject.tag == "Puddle Floor" && */isAnythingPlaying == false){
                //Stops all sounds, plays a footstep, then starts playing a new footstep every .5 sec
                switch(hit.collider.gameObject.tag){
                case "Stone Floor":
                    isRPlaying = true;
                    ShutUp();
                    RData[d8].GetComponent<AudioSource>().Play ();
                    RData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(RPlayer());
                    break;
                case "Moss Floor":
                    isMPlaying = true;
                    ShutUp();
                    MData[d8].GetComponent<AudioSource>().Play ();
                    MData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(MPlayer());
                    break;
                case "Sand on Stone Floor":
                    isAPlaying = true;
                    ShutUp();
                    AData[d8].GetComponent<AudioSource>().Play ();
                    AData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(APlayer());
                    break;
                case "Sand Floor":
                    isSPlaying = true;
                    ShutUp();
                    SData[d8].GetComponent<AudioSource>().Play ();
                    SData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(SPlayer());
                    break;
                case "Puddle Floor":
                    isPPlaying = true;
                    ShutUp();
                    PData[d8].GetComponent<AudioSource>().Play ();
                    PData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(PPlayer());
                    break;
                case "Water Floor":
                    isKPlaying = true;
                    ShutUp();
                    KData[d8].GetComponent<AudioSource>().Play ();
                    KData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(KPlayer());
                    break;
                case "Wooden Floor":
                    isWPlaying = true;
                    ShutUp();
                    WData[d8].GetComponent<AudioSource>().Play ();
                    WData[d8].GetComponent<AudioSource>().volume=1;
                    StartCoroutine(WPlayer());
                    break;
                case "Room1Tablet":
                    ShutUp();
                    StartCoroutine(WPlayer());
                    break;
                default:
                    StartCoroutine(NPlayer());
                    break;
                }
                isAnythingPlaying=true;
                //Debug.Log ("Walking in a puddle");
                //Debug.Log (d8);

            }
        }
    }

Usage Example

Beispiel #1
0
        public IEnumerator ConditionsActivateOnlyAfterBehaviors()
        {
            Step step = new Step("Step1");
            EndlessConditionMock conditionMock = new EndlessConditionMock();
            EndlessBehaviorMock  behaviorMock  = new EndlessBehaviorMock();
            Transition           transition    = new Transition();

            transition.Data.Conditions.Add(conditionMock);
            step.Data.Transitions.Data.Transitions.Add(transition);
            step.Data.Behaviors.Data.Behaviors.Add(behaviorMock);
            step.Configure(RuntimeConfigurator.Configuration.Modes.CurrentMode);

            step.LifeCycle.Activate();

            while (behaviorMock.LifeCycle.Stage != Stage.Activating)
            {
                Assert.AreEqual(Stage.Activating, step.LifeCycle.Stage);
                Assert.AreEqual(Stage.Inactive, conditionMock.LifeCycle.Stage);
                yield return(null);

                step.Update();
            }

            behaviorMock.LifeCycle.MarkToFastForwardStage(Stage.Activating);

            while (conditionMock.LifeCycle.Stage != Stage.Active)
            {
                Assert.AreEqual(Stage.Activating, step.LifeCycle.Stage);
                yield return(null);

                step.Update();
            }
        }
All Usage Examples Of Step::Update