コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (this.state != this.oldState)
        {
            if (this.state == ContainerState.Idle)
            {
                directioner.localFrom = Vector3.forward;
                directioner.to        = Vector3.up;
            }
            else if (this.state == ContainerState.Picked)
            {
                directioner.localFrom = Vector3.forward;
                directioner.to        = Vector3.up;
            }
            else if (this.state == ContainerState.Pouring)
            {
                this.positioner.targetPosition = this.pouringPosition;
                this.positioner.enabled        = true;
                this.GetComponent <Rigidbody>().isKinematic = true;
            }
            else if (this.state == ContainerState.Returned)
            {
                this.objectDragger.Detach();
            }

            if (this.state != ContainerState.Pouring)
            {
                this.positioner.enabled = false;
                this.GetComponent <Rigidbody>().isKinematic = false;
            }

            this.oldState = this.state;
        }

        if (this.state == ContainerState.Picked)
        {
            objectDragger.Drag();
        }

        if (this.state == ContainerState.Pouring)
        {
            directioner.localFrom = Vector3.forward;
            directioner.to        = Vector3.Normalize(tubeTip - this.transform.position);

            if (!this.sound.isPlaying)
            {
                this.sound.Play();
            }

            filledTube.Fill();

            if (filledTube.isFilled())
            {
                this.state = ContainerState.Picked;
                this.sound.Stop();
            }
        }
    }
コード例 #2
0
ファイル: MainBehaviour.cs プロジェクト: Wanghuaichen/Chem
    void Update()
    {
        if (this.state != this.oldState)
        {
            if (this.state == MainState.PostDissolution)
            {
                this.firstTube.state  = TubeBehaviour.TubeState.Idle;
                this.secondTube.state = TubeBehaviour.TubeState.Idle;

                this.firstTube.sample.state  = SampleBehaviour.SampleState.Dissolved;
                this.secondTube.sample.state = SampleBehaviour.SampleState.Dissolved;
            }

            this.oldState = this.state;
        }

        if (this.state == MainState.StartAnimation)
        {
            //this.animation.Play("CameraFlyIn", AnimationPlayMode.Stop);
            this.state = MainState.Filling;
        }
        else if (this.state == MainState.Dissolution)
        {
            this.GetComponent <Animation>().Play("TubeCloseUp", AnimationPlayMode.Stop);
        }

        if (this.firstTube.isDissolving() && this.secondTube.isDissolving() && this.state != MainState.PostDissolution)
        {
            this.state        = MainState.Dissolution;
            this.pincet.state = PincetBehaviour.PincetState.Idle;
        }

        if (this.oldState == MainState.PostDissolution && feSample.isReturned() && znSample.isReturned())
        {
            this.state = MainState.Finishing;
        }

        if (oldState == MainState.Finishing && this.pincet.isReturned())
        {
            this.state = MainState.Finished;
        }

        if (this.oldState == MainState.Filling && firstTube.isFilled() && secondTube.isFilled())
        {
            this.state = MainState.Filled;
        }

        if (this.oldState == MainState.Filled && this.container.isReturned())
        {
            this.state = MainState.Pincet;
        }
    }