コード例 #1
0
    public void Awake()
    {
        var allBodyParts = this.GetComponentsInChildren <BodyPart>();

        foreach (var bodyPart in allBodyParts)
        {
            bodyPart.partName = bodyPart.gameObject.name;

            var state = GlobalGameController
                        .globalInstance
                        .currentPlayerBodyState
                        .FirstOrDefault(s => s.bodyPartName == bodyPart.partName);

            if (state.bodyPartName == default(BodyPartGlobalState).bodyPartName)
            {
                Debug.Log("Adding default body part global state for " + bodyPart.partName);
                state = new BodyPartGlobalState()
                {
                    bodyPartName = bodyPart.partName,
                    currentType  = BodyPartType.Human
                };

                GlobalGameController
                .globalInstance
                .currentPlayerBodyState
                .Add(state);
            }

            bodyPart.currentType = state.currentType;
            bodyPart.InitializeBasedOnCurrentType();
        }
    }
コード例 #2
0
    public void StartOperation()
    {
        var currentlySelectedPart = PartHighlighter.instance.selectedBodyPart;

        if (currentlySelectedPart.currentType == BodyPartType.Robotic)
        {
            return;
        }

        this.currentlyOperatingBodyPart = this
                                          .currentPlayerBodyState
                                          .FirstOrDefault(part => part.bodyPartName == currentlySelectedPart.partName);

        var definition = this.FindHumanPartDefinition(currentlySelectedPart.partName);

        if (definition.bodyPartName != default(HumanPartDefinition).bodyPartName)
        {
            this.currentBlood   = definition.blood;
            this.currentImunity = definition.imunity;
        }

        switch (currentlySelectedPart.partName)
        {
        case "Upper Left Arm":
        case "Upper Right Arm":
            this.MoveIntoOperationScene("ArmOperation");
            break;

        case "Lower Left Arm":
        case "Lower Right Arm":
            this.MoveIntoOperationScene("ArmOperation2");
            break;

        case "Eyes":
            this.MoveIntoOperationScene("EyeOperation");
            break;

        case "Head":
            this.MoveIntoOperationScene("HeadOperation");
            break;

        case "Neck":
            this.MoveIntoOperationScene("NeckOperation");
            break;

        case "Torso":
            this.MoveIntoOperationScene("TorsoOperation");
            break;

        case "Right Leg":
            this.MoveIntoOperationScene("LegOperation");
            break;

        case "Left Leg":
            this.MoveIntoOperationScene("LegOperation2");
            break;

        case "Heart":
            this.MoveIntoOperationScene("HeartOperation");
            break;

        case "Lungs":
            this.MoveIntoOperationScene("LungsOperation");
            break;

        default:
            Debug.LogWarning("Operation level not defined for body part " + currentlySelectedPart.partName);
            break;
        }
    }