예제 #1
0
        void PrepareDepth(LimbVisual visual)
        {
            float[] headZ     = new float[4];
            float[] torsoZ    = new float[4];
            float[] leftArmZ  = new float[4];
            float[] rightArmZ = new float[4];
            float[] leftLegZ  = new float[4];
            float[] rightLegZ = new float[4];

            headZ[(int)Facing.Down]     = 1;
            torsoZ[(int)Facing.Down]    = 2;
            leftArmZ[(int)Facing.Down]  = 3;
            rightArmZ[(int)Facing.Down] = 4;
            leftLegZ[(int)Facing.Down]  = 5;
            rightLegZ[(int)Facing.Down] = 6;

            headZ[(int)Facing.Up]     = 1;
            torsoZ[(int)Facing.Up]    = 2;
            leftArmZ[(int)Facing.Up]  = 3;
            rightArmZ[(int)Facing.Up] = 4;
            leftLegZ[(int)Facing.Up]  = 5;
            rightLegZ[(int)Facing.Up] = 6;

            headZ[(int)Facing.Left]     = 1;
            leftArmZ[(int)Facing.Left]  = 2;
            torsoZ[(int)Facing.Left]    = 3;
            leftLegZ[(int)Facing.Left]  = 4;
            rightLegZ[(int)Facing.Left] = 5;
            rightArmZ[(int)Facing.Left] = 6;

            headZ[(int)Facing.Right]     = 1;
            rightArmZ[(int)Facing.Right] = 2;
            torsoZ[(int)Facing.Right]    = 3;
            rightLegZ[(int)Facing.Right] = 4;
            leftLegZ[(int)Facing.Right]  = 5;
            leftArmZ[(int)Facing.Right]  = 6;

            float[] result = new float[4];

            if (type == LimbComponentType.Head)
            {
                result = headZ;
            }
            else if (type == LimbComponentType.Arm)
            {
                result = position == LimbPosition.Left ? leftArmZ : rightArmZ;
            }
            else if (type == LimbComponentType.Leg)
            {
                result = position == LimbPosition.Left ? leftLegZ : rightLegZ;
            }
            else if (type == LimbComponentType.Torso)
            {
                result = torsoZ;
            }

            for (int i = 0; i < 4; i++)
            {
                result[i] += humanoidZ;
            }

            visual.SetDepths(result);
        }
예제 #2
0
        public override void Start()
        {
            base.Start();

            PartTypes theType = PartTypes.Torso;

            if (type == LimbComponentType.Head)
            {
                if (head == HeadSubType.Bite)
                {
                    theType = PartTypes.BiteHead;
                }
                else if (head == HeadSubType.Bomb)
                {
                    theType = PartTypes.BombHead;
                }
                else if (head == HeadSubType.Laser)
                {
                    theType = PartTypes.LaserHead;
                }
                else if (head == HeadSubType.Human)
                {
                    theType = PartTypes.Head;
                }
            }
            else if (type == LimbComponentType.Arm)
            {
                if (arm == ArmSubType.Hammer)
                {
                    theType = position == LimbPosition.Left ? PartTypes.HammerArmLeft : PartTypes.HammerArmRight;
                }
                else if (arm == ArmSubType.Hook)
                {
                    theType = position == LimbPosition.Left ? PartTypes.HookArmLeft : PartTypes.HookArmRight;
                }
                else if (arm == ArmSubType.Long)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LongArmLeft : PartTypes.LongArmRight;
                }
                else if (arm == ArmSubType.Human)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LeftArm : PartTypes.RightArm;
                }
            }
            else if (type == LimbComponentType.Leg)
            {
                if (leg == LegSubType.Gun)
                {
                    theType = position == LimbPosition.Left ? PartTypes.GunLegLeft : PartTypes.GunLegRight;
                }
                else if (leg == LegSubType.Rocket)
                {
                    theType = position == LimbPosition.Left ? PartTypes.RocketLegLeft : PartTypes.RocketLegRight;
                }
                else if (leg == LegSubType.Human)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LeftLeg : PartTypes.RightLeg;
                }
            }
            else if (type == LimbComponentType.Torso)
            {
                if (torso == TorsoSubType.Human)
                {
                    theType = PartTypes.Torso;
                }
                else if (torso == TorsoSubType.Robot)
                {
                    theType = PartTypes.RobotTorso;
                }
            }

            LimbVisual visual = new LimbVisual(theType);

            this.blob.AddComponent(visual);
            PrepareDepth(visual);
        }