예제 #1
0
파일: main.cs 프로젝트: dpoetzsch/ust-myo
    public static void OnGrabbed(Extremity extremity, int likelyhood, Rotation rotation)
    {
        switch (extremity)
        {
        case Extremity.HAND_LEFT:
            Console.Write("Left hand: ");
            break;

        case Extremity.HAND_RIGHT:
            Console.Write("Right hand: ");
            break;

        case Extremity.FOOT_LEFT:
            Console.Write("Left foot: ");
            break;

        case Extremity.FOOT_RIGHT:
            Console.Write("Right foot: ");
            break;
        }
        Console.Write(likelyhood);
        Console.Write(" [rotation: ");
        Console.Write(rotation.angleX);
        Console.Write(" ");
        Console.Write(rotation.angleX);
        Console.Write(" ");
        Console.Write(rotation.angleX);
        Console.WriteLine("]");
    }
예제 #2
0
        public static bool HasExtremity(IRoadTile a, Extremity x)
        {
            switch (x)
            {
            case Extremity.Top:
                return
                    (a.Type == RoadTile.RoadType.Vertical ||
                     a.Type == RoadTile.RoadType.TopLeft ||
                     a.Type == RoadTile.RoadType.TopRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeft ||
                     a.Type == RoadTile.RoadType.TopBottomRight ||
                     a.Type == RoadTile.RoadType.TopLeftRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeftRight);

            case Extremity.Bottom:
                return
                    (a.Type == RoadTile.RoadType.Vertical ||
                     a.Type == RoadTile.RoadType.BottomLeft ||
                     a.Type == RoadTile.RoadType.BottomRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeft ||
                     a.Type == RoadTile.RoadType.TopBottomRight ||
                     a.Type == RoadTile.RoadType.BottomLeftRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeftRight);

            case Extremity.Left:
                return
                    (a.Type == RoadTile.RoadType.Horizontal ||
                     a.Type == RoadTile.RoadType.TopLeft ||
                     a.Type == RoadTile.RoadType.BottomLeft ||
                     a.Type == RoadTile.RoadType.TopBottomLeft ||
                     a.Type == RoadTile.RoadType.TopLeftRight ||
                     a.Type == RoadTile.RoadType.BottomLeftRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeftRight);

            case Extremity.Right:
                return
                    (a.Type == RoadTile.RoadType.Horizontal ||
                     a.Type == RoadTile.RoadType.TopRight ||
                     a.Type == RoadTile.RoadType.BottomRight ||
                     a.Type == RoadTile.RoadType.TopBottomRight ||
                     a.Type == RoadTile.RoadType.TopLeftRight ||
                     a.Type == RoadTile.RoadType.BottomLeftRight ||
                     a.Type == RoadTile.RoadType.TopBottomLeftRight);
            }
            return(false);
        }
예제 #3
0
 private void TakeEnergy(bool take, Grip grip, LimbsEnum limb)
 {
     if (grip)
     {
         Extremity e = Joints[(int)limb].GetComponent <Extremity>();
         if (e)
         {
             grip.inRangeExtremity = e;
         }
         if (take)
         {
             grip.TakeEnergy(GripCount());
         }
         else
         {
             grip.PreviewEnergy(GripCount());
         }
     }
 }
예제 #4
0
 private bool LockExtremity()
 {
     if (activeJoint != 5)
     {
         Extremity extremity = Joints[activeJoint].GetComponent <Extremity>();
         if (extremity && extremity.GripInRange)
         {
             print("locking " + extremity.name + " to " + extremity.GripInRange.name);
             particles[activeJoint].lockInGrip   = true;
             particles[activeJoint].lockPosition = GetWorld();
             if (extremity.IsOverStreched())
             {
                 InfoMessageText = "That grip is not going to work!";
             }
             ToggleGrip(activeJoint);
             activeJoint = 5;
             PreviewEnergy();
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
 internal void Lock(Extremity extremity)
 {
     extremity.GripInRange = this;
     inRangeExtremity      = extremity;
     shine = true;
 }
예제 #6
0
 private void ReleaseGrip()
 {
     inRangeExtremity.GripInRange = null;
     inRangeExtremity             = null;
     shine = false;
 }