Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     controller          = GetComponent <Controller2D>();
     animationGameObject = transform.FindChild("Animations");
     myAnimator          = animationGameObject.GetComponent <Animator>();
     myRenderer          = animationGameObject.GetComponent <SpriteRenderer>();
     originalMaxVelocity = maxVelocity;
     myRotation          = animationGameObject.eulerAngles;
     myParticleSystem    = transform.FindChild("PlayerParticles").GetComponent <ParticleSystem>();
     inventory           = GameObject.Find("Main").GetComponent <Inventory>();
     if (GameObject.Find("Womb"))
     {
         theWomb = GameObject.Find("Womb").GetComponent <Womb>();
     }
 }
Beispiel #2
0
        public bool TrySpawnChildWomb(bool ignoreRoofedRequirement, out Womb newWomb)
        {
            if (!this.CanSpawnChildWomb)
            {
                newWomb = null;
                return(false);
            }
            IntVec3 invalid = IntVec3.Invalid;

            for (int i = 0; i < 3; i++)
            {
                float minDist = this.Props.WombSpawnPreferredMinDist;
                if (i == 1)
                {
                    minDist = 0f;
                }
                else if (i == 2)
                {
                    newWomb = null;
                    return(false);
                }
                if (CellFinder.TryFindRandomReachableCellNear(this.parent.Position, this.Props.WombSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), (IntVec3 c) => this.CanSpawnWombAt(c, minDist, ignoreRoofedRequirement), null, out invalid, 999999))
                {
                    break;
                }
            }
            newWomb = (WombBetweenWorlds)GenSpawn.Spawn(this.parent.def, invalid);
            if (newWomb.Faction != this.parent.Faction)
            {
                newWomb.SetFaction(this.parent.Faction, null);
            }
            WombBetweenWorlds Womb = this.parent as WombBetweenWorlds;

            if (Womb != null)
            {
                newWomb.active = Womb.active;
            }
            this.CalculateNextWombSpawnTick();
            return(true);
        }
Beispiel #3
0
 public override string BodyPartName()
 {
     return(Womb.Name());            //idk. really, this should implement saveable, not body part saveable.
 }