コード例 #1
0
    public void Init(Player P, Vector3 _velocity, Vector3 _angularVelocity)
    {
        BP            = GetComponent <BodyPositions>();
        P.CamOverride = CameraEmpty;

        for (int i = 0; i < BP.Syncs.Count; i++)
        {
            BP.Syncs[i].position = P.BodyInfo.Syncs[i].position;
            BP.Syncs[i].rotation = P.BodyInfo.Syncs[i].rotation;

            if (BP.Syncs[i].GetComponent <Rigidbody>() != null)
            {
                BP.Syncs[i].GetComponent <Rigidbody>().velocity        = _velocity;
                BP.Syncs[i].GetComponent <Rigidbody>().angularVelocity = _angularVelocity;
            }
        }

        Mats = Model.materials;
        Mats[0].SetColor("_albedo", P.MRD._skinColor);          //SKIN
        Mats[3].SetColor("_albedo", P.MRD._skinColor);          //FACE
        Mats[1].SetColor("_albedo", P.MRD._pantsColor);         //PANTS
        Mats[2].SetColor("_albedo", P.MRD._shirtColor);         //SHIRT

        if (P.MRD._faceIndex != 4)
        {
            Mats[3].SetTexture("_face", GameServer.GS.GetFace(P.MRD._faceIndex)); //FACE
        }
        else
        {
            Texture2D customFace          = new Texture2D(32, 32, TextureFormat.Alpha8, false);
            byte[]    CustomFaceDataArray = new byte[P.MRD._customFaceData.Count];

            for (int i = 0; i < P.MRD._customFaceData.Count; i++)
            {
                CustomFaceDataArray[i] = P.MRD._customFaceData[i];
            }

            customFace.LoadImage(CustomFaceDataArray);
            customFace.filterMode = FilterMode.Point;
            customFace.Apply();


            Mats[3].SetTexture("_face", customFace); //FACE
        }

        Invoke("Despawn", Settings._ragdollDespawnTime);
    }
コード例 #2
0
      public void SetBodyPosition(BodyPositions bodyPosition)
      {
         UInt16 adjustedSolenoidStatus = this.robotSolenoidSetPoint;

         if (BodyPositions.off == bodyPosition)
         {
            adjustedSolenoidStatus = 0;
         }
         else if (BodyPositions.closed == bodyPosition)
         {
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontDrillCover));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearDrillCover));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontNozzleExtend));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearNozzleExtend));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmExtend));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmExtend));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.lowerArmExtend));
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.frontArmRetract);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.rearArmRetract);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.lowerArmRetract);
         }
         else if (BodyPositions.opened == bodyPosition)
         {
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.frontArmExtend);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.rearArmExtend);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.lowerArmExtend);
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.lowerArmRetract));
         }
         else if (BodyPositions.frontLoose == bodyPosition)
         {
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmExtend));
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.rearArmExtend);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.lowerArmExtend);
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.lowerArmRetract));
         }
         else if (BodyPositions.rearLoose == bodyPosition)
         {
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.frontArmExtend);
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmExtend));
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.lowerArmExtend);
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.lowerArmRetract));
         }
         else if (BodyPositions.drill == bodyPosition)
         {
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.frontArmExtend);
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.rearArmExtend);
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.lowerArmExtend));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.frontArmRetract));
            adjustedSolenoidStatus &= (UInt16)~(this.GetSolenoidMask(Solenoids.rearArmRetract));
            adjustedSolenoidStatus |= this.GetSolenoidMask(Solenoids.lowerArmRetract);
         }

         this.UpdateSolenoidSetPoint(adjustedSolenoidStatus);
      }
コード例 #3
0
ファイル: NicBotComm.cs プロジェクト: OakdaleDaddy/ULC-build
 public void SetBodyPosition(BodyPositions bodyPosition)
 {
    RobotCommBus.Instance.SetBodyPosition(bodyPosition);
 }