Esempio n. 1
0
        /// <summary>
        /// Adds a new body part to this body part, and removes the old part whose place is
        /// being taken if possible
        /// </summary>
        /// <param name="prevImplant">Old body part to be removed</param>
        /// <param name="newImplant">New body part to be added</param>
        public virtual void ImplantAdded(Pickupable prevImplant, Pickupable newImplant)
        {
            //Check what's being added and add sprites if appropriate
            if (newImplant)
            {
                BodyPart implant = newImplant.GetComponent <BodyPart>();
                ContainBodyParts.Add(implant);
                implant.ContainedIn = this;
                //Initialisation j**z
                if (HealthMaster != null)
                {
                    SetUpBodyPart(implant);
                }
            }

            //Remove sprites if appropriate
            if (prevImplant)
            {
                BodyPart implant = prevImplant.GetComponent <BodyPart>();
                implant.HealthMaster = null;
                HealthMaster.RemoveImplant(implant);
                implant.RemovedFromBody(HealthMaster);
                implant.ContainedIn = null;
                ContainBodyParts.Remove(implant);
                //bodyPartSprites?.UpdateSpritesOnImplantRemoved(implant);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a new body part to this body part container, and removes the old part whose place is
        /// being taken if possible
        /// </summary>
        /// <param name="prevImplant">Old body part to be removed</param>
        /// <param name="newImplant">New body part to be added</param>
        public virtual void ImplantAdded(Pickupable prevImplant, Pickupable newImplant)
        {
            //Check what's being added and add sprites if appropriate
            if (newImplant)
            {
                BodyPart implant = newImplant.GetComponent <BodyPart>();
                ContainsLimbs.Add(implant);
                healthMaster.AddNewImplant(implant);
                SubBodyPartAdded(implant);
                implant.Root         = this;
                implant.HealthMaster = healthMaster;
                implant.SetUpSystems();
                SetupSpritesNID(implant);
            }

            //Remove sprites if appropriate
            if (prevImplant)
            {
                BodyPart implant = prevImplant.GetComponent <BodyPart>();
                ContainsLimbs.Remove(implant);
                healthMaster.RemoveImplant(implant);
                implant.RemovedFromBody(healthMaster);
                implant.HealthMaster = null;
                implant.Root         = null;
                RemoveSpritesNID(implant);
            }
        }