示例#1
0
        public void EvaluateHealth()
        {
            if (this.gameObject.GetComponent <CharacterData>().isDead == false)
            {
                int         eyeCount   = 0;
                int         loseLimb   = 0;
                OrganOrLimb limbToLose = null;

                foreach (OrganOrLimb o in animate.limbsAndOrgans)
                {
                    if ((int)o.partType == 0)
                    {
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().martialMod >= -2)
                        {
                            this.gameObject.GetComponent <CharacterData>().martialMod -= 2;
                        }
                        else if (o.health <= 0 && this.gameObject.GetComponent <CharacterData>().hasLostLimb == false && this.gameObject.GetComponent <CharacterData>().canLoseLimbs == true)
                        {
                            if (o.isLeftOfPair == true)
                            {
                                loseLimb   = 1;
                                limbToLose = o;
                            }
                            else
                            {
                                loseLimb   = 2;
                                limbToLose = o;
                            }
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 1)
                    {
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().moveDistMod >= -2)
                        {
                            this.gameObject.GetComponent <CharacterData>().moveDistMod -= 1;
                        }
                        else if (o.health <= 0 && this.gameObject.GetComponent <CharacterData>().moveDistMod >= -4)
                        {
                            this.gameObject.GetComponent <CharacterData>().moveDistMod -= -2;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 2)
                    {
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().intelligenceMod > -4)
                        {
                            this.gameObject.GetComponent <CharacterData>().intelligenceMod -= 2;
                        }
                        else if (o.health == 0)
                        {
                            this.gameObject.GetComponent <CharacterData>().isUnconscious = true;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 3)
                    {
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().intelligenceMod > -4)
                        {
                            this.gameObject.GetComponent <CharacterData>().athleticsMod -= 2;
                        }
                        else if (o.health == 0)
                        {
                            this.gameObject.GetComponent <CharacterData>().isDead = true;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 4 && this.gameObject.GetComponent <CharacterData>().strengthMod > -4)
                    {
                        if (o.health < o.maxHealth / 2)
                        {
                            this.gameObject.GetComponent <CharacterData>().strengthMod -= 2;
                        }
                        else if (o.health == 0)
                        {
                            this.gameObject.GetComponent <CharacterData>().isDead = true;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 5)
                    {
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().enduranceMod > -4)
                        {
                            this.gameObject.GetComponent <CharacterData>().enduranceMod -= 2;
                        }
                        else if (o.health == 0 && this.gameObject.GetComponent <CharacterData>().enduranceMod > -8)
                        {
                            this.gameObject.GetComponent <CharacterData>().enduranceMod -= 4;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 6)
                    {
                        if (o.health < o.maxHealth / 2)
                        {
                            this.gameObject.GetComponent <CharacterData>().toxinCounter += 5;
                        }
                        else if (o.health == 0)
                        {
                            this.gameObject.GetComponent <CharacterData>().bleedCounter += 10;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 7)
                    {
                        if (o.health < o.maxHealth / 2)
                        {
                            this.gameObject.GetComponent <CharacterData>().bleedCounter += 3;
                        }
                        else if (o.health == 0)
                        {
                            this.gameObject.GetComponent <CharacterData>().isDead = true;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                    if ((int)o.partType == 8)
                    {
                        eyeCount++;
                        if (o.health < o.maxHealth / 2 && this.gameObject.GetComponent <CharacterData>().sightMod > 5)
                        {
                            this.gameObject.GetComponent <CharacterData>().sightMod -= 1;
                        }
                        else if (o.health == 0)
                        {
                            eyeCount--;
                        }
                        if (o.health < 0)
                        {
                            animate.mind.shock += 1;
                        }
                    }
                }

                if (loseLimb == 1)
                {
                    this.gameObject.GetComponent <CharacterData>().RemoveLimb(25);
                    animate.limbsAndOrgans.Remove(limbToLose);
                    this.gameObject.GetComponent <CharacterData>().canCast = false;
                }
                else if (loseLimb == 2)
                {
                    this.gameObject.GetComponent <CharacterData>().RemoveLimb(75);
                    animate.limbsAndOrgans.Remove(limbToLose);
                    this.gameObject.GetComponent <CharacterData>().canAttack = false;
                }
                if (eyeCount > 0)
                {
                    this.gameObject.GetComponent <CharacterData>().canSee    = true;
                    this.gameObject.GetComponent <CharacterData>().baseSight = eyeCount * 5;
                }
                else
                {
                    this.gameObject.GetComponent <CharacterData>().canSee = false;
                    if (this.gameObject == CharacterData.instance.gameObject)
                    {
                        CharacterData.instance.sightMod = CharacterData.instance.baseSight - 0.01f;
                    }
                }

                float averageHealth = 0;
                foreach (OrganOrLimb h in animate.limbsAndOrgans)
                {
                    averageHealth += h.health;
                }
                averageHealth         = averageHealth / animate.limbsAndOrgans.Count;
                animate.overallHealth = averageHealth;
            }
        }
示例#2
0
        void Start()
        {
            if (isAnimate == true)
            {
                if (isHumanoid == true)
                {
                    OrganOrLimb lA = new OrganOrLimb();
                    lA.partType     = (OrgansAndLimbs)0;
                    lA.isLeftOfPair = true;
                    lA.name         = "left arm";
                    animate.limbsAndOrgans.Add(lA);

                    OrganOrLimb rA = new OrganOrLimb();
                    rA.partType = (OrgansAndLimbs)0;
                    rA.name     = "right arm";
                    animate.limbsAndOrgans.Add(rA);

                    OrganOrLimb lL = new OrganOrLimb();
                    lL.partType     = (OrgansAndLimbs)1;
                    lL.isLeftOfPair = true;
                    lL.name         = "left leg";
                    animate.limbsAndOrgans.Add(lL);

                    OrganOrLimb rL = new OrganOrLimb();
                    rL.partType = (OrgansAndLimbs)1;
                    rL.name     = "right leg";
                    animate.limbsAndOrgans.Add(rL);

                    OrganOrLimb h = new OrganOrLimb();
                    h.partType        = (OrgansAndLimbs)2;
                    h.name            = "head";
                    h.centerOfThought = true;
                    animate.limbsAndOrgans.Add(h);

                    //Sanguine, Choleric, Melancholic, Phlegmatic
                    if ((int)animate.mind.personality == 0)
                    {
                        animate.mind.sanity  += -5;
                        animate.mind.stress  += 10;
                        animate.mind.anger   += 5;
                        animate.mind.sadness += 0;
                    }
                    else if ((int)animate.mind.personality == 1)
                    {
                        animate.mind.sanity  += -5;
                        animate.mind.stress  += 5;
                        animate.mind.anger   += 10;
                        animate.mind.sadness += 0;
                    }
                    else if ((int)animate.mind.personality == 2)
                    {
                        animate.mind.sanity  += 5;
                        animate.mind.stress  += 0;
                        animate.mind.anger   += -5;
                        animate.mind.sadness += 10;
                    }
                    else if ((int)animate.mind.personality == 3)
                    {
                        animate.mind.sanity  += 10;
                        animate.mind.stress  += 0;
                        animate.mind.anger   += -5;
                        animate.mind.sadness += 5;
                    }

                    OrganOrLimb t = new OrganOrLimb();
                    t.partType = (OrgansAndLimbs)3;
                    t.name     = "torso";
                    animate.limbsAndOrgans.Add(t);

                    OrganOrLimb c = new OrganOrLimb();
                    c.partType = (OrgansAndLimbs)4;
                    c.name     = "chest";
                    animate.limbsAndOrgans.Add(c);

                    OrganOrLimb lLu = new OrganOrLimb();
                    lLu.partType     = (OrgansAndLimbs)5;
                    lLu.isLeftOfPair = true;
                    lLu.name         = "left lung";
                    animate.limbsAndOrgans.Add(lLu);

                    OrganOrLimb rLu = new OrganOrLimb();
                    rLu.partType = (OrgansAndLimbs)5;
                    rLu.name     = "right lung";
                    animate.limbsAndOrgans.Add(rLu);

                    OrganOrLimb s = new OrganOrLimb();
                    s.partType = (OrgansAndLimbs)6;
                    s.name     = "stomach";
                    animate.limbsAndOrgans.Add(s);

                    OrganOrLimb hrt = new OrganOrLimb();
                    hrt.partType = (OrgansAndLimbs)7;
                    hrt.name     = "heart";
                    animate.limbsAndOrgans.Add(hrt);

                    OrganOrLimb lE = new OrganOrLimb();
                    lE.partType     = (OrgansAndLimbs)8;
                    lE.isLeftOfPair = true;
                    lE.name         = "left eye";
                    animate.limbsAndOrgans.Add(lE);

                    OrganOrLimb rE = new OrganOrLimb();
                    rE.partType = (OrgansAndLimbs)8;
                    rE.name     = "right eye";
                    animate.limbsAndOrgans.Add(rE);

                    this.gameObject.GetComponent <CharacterData>().canSee    = true;
                    this.gameObject.GetComponent <Controller>().canMove      = true;
                    this.gameObject.GetComponent <CharacterData>().canAttack = true;
                    this.gameObject.GetComponent <CharacterData>().canCast   = true;
                    this.gameObject.GetComponent <Controller>().canAct       = true;
                }

                modifiedWeight = animate.weight;
                foreach (OrganOrLimb l in animate.limbsAndOrgans)
                {
                    l.maxHealth = this.gameObject.GetComponent <CharacterData>().maxHealth;
                    l.health    = this.gameObject.GetComponent <CharacterData>().maxHealth;
                }

                EvaluateHealth();
            }
            else
            {
                modifiedWeight = inanimate.weight;
            }
        }