コード例 #1
0
    /// Add any missing systems:
    private void InitSystems()
    {
        registerTile = GetComponent <RegisterTile>();
        //Always include blood for living entities:
        bloodSystem = GetComponent <BloodSystem>();
        if (bloodSystem == null)
        {
            bloodSystem = gameObject.AddComponent <BloodSystem>();
        }

        //Always include respiratory for living entities:
        respiratorySystem = GetComponent <RespiratorySystem>();
        if (respiratorySystem == null)
        {
            respiratorySystem = gameObject.AddComponent <RespiratorySystem>();
        }

        var tryGetHead = FindBodyPart(BodyPartType.Head);

        if (tryGetHead != null && brainSystem == null)
        {
            if (tryGetHead.Type != BodyPartType.Chest)
            {
                //Head exists, install a brain system
                brainSystem = gameObject.AddComponent <BrainSystem>();
            }
        }
    }
コード例 #2
0
    void InitSystem()
    {
        playerScript          = GetComponent <PlayerScript>();
        bloodSystem           = GetComponent <BloodSystem>();
        respiratorySystem     = GetComponent <RespiratorySystem>();
        livingHealthBehaviour = GetComponent <LivingHealthBehaviour>();

        //Server only
        if (CustomNetworkManager.Instance._isServer)
        {
            //Spawn a brain and connect the brain to this living entity
            brain = new Brain();
            brain.ConnectBrainToBody(gameObject);
            if (playerScript != null)
            {
                //TODO: See https://github.com/unitystation/unitystation/issues/1429
            }
            init = true;
        }
    }
コード例 #3
0
 public Chest(Bone[] chestBoneStructure = null, Heart heart = null, RespiratorySystem lungs = null)
 {
     Bones = chestBoneStructure ?? DefaultBoneStructures.DefaultChestBones;
     Heart = heart ?? new Heart();
     Lungs = lungs ?? new RespiratorySystem();
 }