// Use this for initialization
 void Start()
 {
     _front   = front.nothing;
     initPos1 = Bones [1].transform.position;
     initPos3 = Bones [3].transform.position;
 }
    protected override void UpdateState()
    {
        if (_actualState == State.Nothing && GestesManager.finishedMvt == Activated.Nothing)
        {
            if (Bones[0].transform.position.z <BonesReference.transform.position.z + StartAction && Bones[1].transform.position.z> Bones[0].transform.position.z && Bones[2].transform.position.z > BonesReference.transform.position.z)
            {
                _front       = front.left;
                _actualState = State.Start;
                initPos1     = Bones[1].transform.position;
                initPos3     = Bones[3].transform.position;
            }
            else if (Bones[2].transform.position.z <BonesReference.transform.position.z + StartAction && Bones[3].transform.position.z> Bones[2].transform.position.z && Bones[0].transform.position.z > BonesReference.transform.position.z)
            {
                _front       = front.right;
                _actualState = State.Start;
                initPos1     = Bones[1].transform.position;
                initPos3     = Bones[3].transform.position;
            }
        }
        else if (_actualState == State.Start && GestesManager.activeMvt == Activated.Nothing)
        {
            switch (_front)
            {
            case front.left:
                if (Bones[0].transform.position.z > BonesReference.transform.position.z && Bones[1].transform.position.y > Bones[0].transform.position.y && Bones[2].transform.position.z < BonesReference.transform.position.z + StartAction)
                {
                    Text.text               = "";
                    _actualState            = State.ReachedX;
                    GestesManager.activeMvt = thisOne;
                }
                break;

            case front.right:
                if (Bones[2].transform.position.z > BonesReference.transform.position.z && Bones[3].transform.position.y > Bones[2].transform.position.y && Bones[0].transform.position.z < BonesReference.transform.position.z + StartAction)
                {
                    Text.text               = "";
                    _actualState            = State.ReachedX;
                    GestesManager.activeMvt = thisOne;
                }
                break;
            }
        }
        else if (_actualState == State.ReachedX)
        {
            switch (_front)
            {
            case front.left:
                if (Bones[0].transform.position.z <BonesReference.transform.position.z + StartAction && Bones[1].transform.position.z> Bones[0].transform.position.z && Bones[2].transform.position.z > BonesReference.transform.position.z)
                {
                    Text.text    = "";
                    _actualState = State.Finish;
                }
                break;

            case front.right:
                if (Bones[2].transform.position.z <BonesReference.transform.position.z + StartAction && Bones[3].transform.position.z> Bones[2].transform.position.z && Bones[0].transform.position.z > BonesReference.transform.position.z)
                {
                    Text.text    = "";
                    _actualState = State.Finish;
                }
                break;
            }
        }
        else if (_actualState == State.Finish)
        {
            _actualState = State.Nothing;
            _startAction = -1;
            Text.text    = Geste;
            _front       = front.nothing;
            GestesManager.finishedMvt = thisOne;
        }
    }
Example #3
0
 //var (frontPixels, backPixels) = await GetFrontBackPixelsAsync(image, faces);
 var(front, back) = GetAvgBrightness(planes.frontPixels, planes.backPixels);