Ejemplo n.º 1
0
 protected internal BodyComposition()
 {
     Height = new Height();
     Waist  = new Waist();
     Hips   = new Hips();
     Weight = new Weight();
 }
Ejemplo n.º 2
0
 public void ResetForScene2()
 {
     ResetBar();
     Hips.GetComponent <SpringJoint>().spring = 1000f;
     Hips.GetComponent <Rigidbody>().AddForce(Vector3.up * 100f);
     BlockBar(true);
 }
Ejemplo n.º 3
0
    /// <summary>
    /// SetHead sets the player character's head position and rotation relative to the given hip value.
    /// </summary>
    public void SetHead(Hips hips, Vector3 forward)
    {
        Vector3 perpendicular = (hips.Right - hips.Left).normalized;
        Vector3 upwards       = Vector3.Cross(forward.normalized, perpendicular);

        transform.position = hips.Position + (Offset.x * forward.normalized) + (Offset.y * upwards);
        transform.rotation = Quaternion.LookRotation(forward, upwards);
    }
Ejemplo n.º 4
0
 public void Fall(Vector3 direction)
 {
     if (!Fallen)
     {
         Fall();
         Hips.GetComponent <Rigidbody>().velocity = direction;
     }
 }
Ejemplo n.º 5
0
    public void SetBody()
    {
        Hips   hips   = hipsManager.Hips;
        Stance stance = stanceManager.Stance;

        Head.SetHead(hips, stance.Forward);
        Left.SetLeg(new Segment(hips.Left, stance.Left.Position, stance.Left.Forward), stepManager.Upwards);
        Right.SetLeg(new Segment(hips.Right, stance.Right.Position, stance.Right.Forward), stepManager.Upwards);
    }
Ejemplo n.º 6
0
 internal BodyComposition(Height heightInches,
                          Waist waistInches,
                          Hips hipsInches,
                          Weight weightPounds) : this()
 {
     Height = heightInches;
     Waist  = waistInches;
     Hips   = hipsInches;
     Weight = weightPounds;
 }
 public override BodyComposition BuildWithoutModelValidation()
 {
     return(new BodyComposition
     {
         Height = Height.Build(_heightInches),
         Hips = Hips.Build(_hipsInches),
         Waist = Waist.Build(_waistInches),
         Weight = Weight.Build(_weightPounds)
     });
 }
 public override BodyCompositionExpanded BuildWithoutModelValidation()
 {
     return(new BodyCompositionExpanded
     {
         Height = Height.Build(_heightInches),
         Waist = Waist.Build(_waistInches),
         Hips = Hips.Build(_hipsInches),
         Weight = Weight.Build(_weightPounds),
         VisceralFat = _visceralFatCm2,
         PercentBodyFat = _percentBodyFat
     });
 }
Ejemplo n.º 9
0
    public void RecoverFromFall()
    {
        //SOUND GOT UP
        //AkSoundEngine.PostEvent("GotUp", gameObject);

        InputController.SetCanAttach(true);
        InputController.BlockControls(false);
        ResetBar();
        BlockBar(true, 5f);

        BalanceGUI.SetActive(true);
        IconImage.SetActive(true);

        Hips.GetComponent <SpringJoint>().spring = 1000f;
        Hips.GetComponent <Rigidbody>().AddForce(Vector3.up * 250f);

        NetworkServerManager.getInstance().ServerStringMessageSender(InputController, "GotUp");
    }
Ejemplo n.º 10
0
        public Skeleton ToNetworkModel()
        {
            Skeleton s = new Skeleton();

            s.UserId        = UserId;
            s.BodyLocation  = BodyLocation.ToCoord();
            s.BodyRotation  = BodyRotation.ToCoord();
            s.Head          = Head.ToCoord();
            s.Neck          = Neck.ToCoord();
            s.Spine         = Spine.ToCoord();
            s.Hips          = Hips.ToCoord();
            s.LeftShoulder  = LeftShoulder.ToCoord();
            s.LeftArm       = LeftArm.ToCoord();
            s.LeftHand      = LeftHand.ToCoord();
            s.RightShoulder = RightShoulder.ToCoord();
            s.RightArm      = RightArm.ToCoord();
            s.RightHand     = RightHand.ToCoord();
            s.LeftKnee      = LeftKnee.ToCoord();
            s.LeftFoot      = LeftFoot.ToCoord();
            s.RightKnee     = RightKnee.ToCoord();
            s.RightFoot     = RightFoot.ToCoord();
            return(s);
        }
Ejemplo n.º 11
0
    public void Fall()
    {
        if (!Fallen)
        {
            Fallen = true;

            BlockBar(true);

            InputController.RandomizeControls();
            InputController.Detach();
            InputController.BlockControls(true);
            InputController.SetCanAttach(false);

            BalanceGUI.SetActive(false);
            IconImage.SetActive(false);

            Hips.GetComponent <SpringJoint>().spring = 0f;
            Hips.GetComponent <Rigidbody>().velocity = Vector3.zero;

            NetworkServerManager.getInstance().ServerStringMessageSender(InputController, "Fallen");
            ShootKeys(MatchManager.getInstance().keyCollected[gameObject.layer - 9]);
            MatchManager.getInstance().keyCollected[gameObject.layer - 9] = 0;
        }
    }
Ejemplo n.º 12
0
 private BodyComposition(double heightInches, double waistInches, double hipsInches, double weightPounds)
     : this(Height.Build(heightInches), Waist.Build(waistInches), Hips.Build(hipsInches),
            Weight.Build(weightPounds))
 {
 }
Ejemplo n.º 13
0
 public void MergeFrom(Skeleton other)
 {
     if (other == null)
     {
         return;
     }
     if (other.UserId != 0UL)
     {
         UserId = other.UserId;
     }
     if (other.bodyLocation_ != null)
     {
         if (bodyLocation_ == null)
         {
             bodyLocation_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         BodyLocation.MergeFrom(other.BodyLocation);
     }
     if (other.bodyRotation_ != null)
     {
         if (bodyRotation_ == null)
         {
             bodyRotation_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         BodyRotation.MergeFrom(other.BodyRotation);
     }
     if (other.head_ != null)
     {
         if (head_ == null)
         {
             head_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         Head.MergeFrom(other.Head);
     }
     if (other.neck_ != null)
     {
         if (neck_ == null)
         {
             neck_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         Neck.MergeFrom(other.Neck);
     }
     if (other.spine_ != null)
     {
         if (spine_ == null)
         {
             spine_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         Spine.MergeFrom(other.Spine);
     }
     if (other.hips_ != null)
     {
         if (hips_ == null)
         {
             hips_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         Hips.MergeFrom(other.Hips);
     }
     if (other.leftShoulder_ != null)
     {
         if (leftShoulder_ == null)
         {
             leftShoulder_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         LeftShoulder.MergeFrom(other.LeftShoulder);
     }
     if (other.leftArm_ != null)
     {
         if (leftArm_ == null)
         {
             leftArm_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         LeftArm.MergeFrom(other.LeftArm);
     }
     if (other.leftHand_ != null)
     {
         if (leftHand_ == null)
         {
             leftHand_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         LeftHand.MergeFrom(other.LeftHand);
     }
     if (other.rightShoulder_ != null)
     {
         if (rightShoulder_ == null)
         {
             rightShoulder_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         RightShoulder.MergeFrom(other.RightShoulder);
     }
     if (other.rightArm_ != null)
     {
         if (rightArm_ == null)
         {
             rightArm_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         RightArm.MergeFrom(other.RightArm);
     }
     if (other.rightHand_ != null)
     {
         if (rightHand_ == null)
         {
             rightHand_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         RightHand.MergeFrom(other.RightHand);
     }
     if (other.leftKnee_ != null)
     {
         if (leftKnee_ == null)
         {
             leftKnee_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         LeftKnee.MergeFrom(other.LeftKnee);
     }
     if (other.leftFoot_ != null)
     {
         if (leftFoot_ == null)
         {
             leftFoot_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         LeftFoot.MergeFrom(other.LeftFoot);
     }
     if (other.rightKnee_ != null)
     {
         if (rightKnee_ == null)
         {
             rightKnee_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         RightKnee.MergeFrom(other.RightKnee);
     }
     if (other.rightFoot_ != null)
     {
         if (rightFoot_ == null)
         {
             rightFoot_ = new global::VrLifeShared.Networking.NetworkingModels.Coord();
         }
         RightFoot.MergeFrom(other.RightFoot);
     }
 }
Ejemplo n.º 14
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserId != 0UL)
            {
                hash ^= UserId.GetHashCode();
            }
            if (bodyLocation_ != null)
            {
                hash ^= BodyLocation.GetHashCode();
            }
            if (bodyRotation_ != null)
            {
                hash ^= BodyRotation.GetHashCode();
            }
            if (head_ != null)
            {
                hash ^= Head.GetHashCode();
            }
            if (neck_ != null)
            {
                hash ^= Neck.GetHashCode();
            }
            if (spine_ != null)
            {
                hash ^= Spine.GetHashCode();
            }
            if (hips_ != null)
            {
                hash ^= Hips.GetHashCode();
            }
            if (leftShoulder_ != null)
            {
                hash ^= LeftShoulder.GetHashCode();
            }
            if (leftArm_ != null)
            {
                hash ^= LeftArm.GetHashCode();
            }
            if (leftHand_ != null)
            {
                hash ^= LeftHand.GetHashCode();
            }
            if (rightShoulder_ != null)
            {
                hash ^= RightShoulder.GetHashCode();
            }
            if (rightArm_ != null)
            {
                hash ^= RightArm.GetHashCode();
            }
            if (rightHand_ != null)
            {
                hash ^= RightHand.GetHashCode();
            }
            if (leftKnee_ != null)
            {
                hash ^= LeftKnee.GetHashCode();
            }
            if (leftFoot_ != null)
            {
                hash ^= LeftFoot.GetHashCode();
            }
            if (rightKnee_ != null)
            {
                hash ^= RightKnee.GetHashCode();
            }
            if (rightFoot_ != null)
            {
                hash ^= RightFoot.GetHashCode();
            }
            return(hash);
        }