示例#1
0
    [HideInInspector] public Color m_feedbackColor;     // transparent = green/red

    public virtual void Start()
    {
        m_effectsActive = new Dictionary <Effect, float>();
        m_health        = GetComponent <UnitHealth>();
        m_stats         = GetComponent <UnitStats>();
        m_shooter       = GetComponent <Shooter>();
        m_abilities     = new List <AbilityWrapper>();
        m_skills        = new List <SkillWrapper>();
        m_modifiers     = gameObject.AddComponent <Modifiers>();
        m_feedbackColor = Constants.YELLOW;

        if (m_stats)
        {
            m_stats.Init(this);
        }
        if (m_shooter)
        {
            m_shooter.Init(this);
        }
        if (m_health)
        {
            m_health.Init(this);
        }
        if (m_inventory)
        {
            m_inventory.Init(this);
        }
        if (m_equipment)
        {
            m_equipment.Init(this);
        }

        // TODO: load abilities, skills and modifiers?

        //foreach(SkillWrapper wrapper in m_skills)
        //if(wrapper.Skill.m_isPassive)
        //wrapper.Skill.Use(this, wrapper.TrainingLevel);

        InvokeRepeating("TickEffects", Constants.EFFECT_TICK_RATE, Constants.EFFECT_TICK_RATE);
        InvokeRepeating("UpdateCharacterSpeed", Constants.CHARACTER_SPEED_UPDATE_RATE, Constants.CHARACTER_SPEED_UPDATE_RATE);
    }