Exemple #1
0
 public float GetFactor(RPGSettings.StatName stat)
 {
     return(GetFactor(stats[stat.ToString()].currentValue));
 }
Exemple #2
0
        // Use this for initialization
        void Start()
        {
            animator    = GetComponent <Animator>();
            brain       = GetComponent <AIBrain>();
            audioSource = GetComponent <AudioSource>();
            if (audioSource == null)
            {
                audioSource = gameObject.AddComponent <AudioSource>();
            }
            InitProp();

            fadeTime = 10.0f;

            for (int i = 0; i < RPGSettings.BasicDamageTypesCount; i++)
            {
                stats[RPGSettings.GetDamageStat((RPGSettings.DamageType)(1 << i))] = new Stat();
            }
            // healing damage boost does make sense
            stats[RPGSettings.GetDamageStat(RPGSettings.DamageType.Healing)] = new Stat();

            // special starting values and non-buffs go here
            stats[RPGSettings.StatName.Energy.ToString()] = new Stat(maxEnergy, false);
            stats[RPGSettings.StatName.Charge.ToString()] = new Stat(0, false);

            // all others are normal buffable stats
            RPGSettings.StatName numStats = (RPGSettings.StatName)System.Enum.GetNames(typeof(RPGSettings.StatName)).Length;
            for (RPGSettings.StatName i = RPGSettings.StatName.EnergyRegen; i <= numStats; i++)
            {
                if (!stats.ContainsKey(i.ToString()))
                {
                    stats[i.ToString()] = new Stat();
                }
            }

            energyStat = stats[RPGSettings.StatName.Energy.ToString()];

            RPGSettings.instance.SetupCharacter(this);

            tpc = GetComponent <ThirdPersonCharacter>();
            if (tpc)
            {
                baseJumpPower = tpc.m_JumpPower;
            }

            Transform beamChild = transform.Find("Beam");

            if (beamChild == null)
            {
                GameObject go = ObjectFactory.GetObject(RPGSettings.instance.beam);
                beamChild               = go.transform;
                beamChild.parent        = transform;
                beamChild.localPosition = Vector3.zero;
            }
            if (beamChild)
            {
                beam = beamChild.GetComponent <BeamRenderer>();
            }

            ApplyPassives();

            //create a tragetting reticle and disable it
            reticle = ObjectFactory.GetObject(RPGSettings.instance.reticle);
            reticle.transform.parent        = transform;
            reticle.transform.localPosition = Vector3.zero;
            reticle.name = "reticle";
            reticle.SetActive(false);

            bodyParts[BodyPart.Root]         = transform;
            bodyParts[BodyPart.Head]         = head;
            bodyParts[BodyPart.Chest]        = chest;
            bodyParts[BodyPart.LeftHand]     = leftHand;
            bodyParts[BodyPart.RightHand]    = rightHand;
            bodyParts[BodyPart.LeftFoot]     = leftFoot;
            bodyParts[BodyPart.RightFoot]    = rightFoot;
            bodyParts[BodyPart.LeftForeArm]  = leftForeArm;
            bodyParts[BodyPart.RightForeArm] = rightForeArm;
            bodyParts[BodyPart.LeftBicep]    = leftBicep;
            bodyParts[BodyPart.RightBicep]   = rightBicep;
            bodyParts[BodyPart.LeftThigh]    = leftThigh;
            bodyParts[BodyPart.LightThigh]   = rightThigh;
            bodyParts[BodyPart.LeftCalf]     = leftCalf;
            bodyParts[BodyPart.RightCalf]    = rightCalf;
            bodyParts[BodyPart.Waist]        = waist;
            bodyParts[BodyPart.Weapon1]      = weapon1;
            bodyParts[BodyPart.Weapon2]      = weapon2;
        }