Пример #1
0
    public void UpdateStaticProperties()
    {
        float level;

        if (HasProperty(BacteriaProperty.Small, out level))
        {
            transform.localScale *= BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Small, level);
        }

        if (HasProperty(BacteriaProperty.Big, out level))
        {
            transform.localScale *= BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Big, level);
        }

        if (HasProperty(BacteriaProperty.Slow, out level))
        {
            m_navMeshAgent.speed = m_speed * BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Slow, level);
        }

        if (HasProperty(BacteriaProperty.Quick, out level))
        {
            m_navMeshAgent.speed = m_speed * BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Quick, level);
        }

        if (HasProperty(BacteriaProperty.Resistant, out level))
        {
            level              = BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Resistant, level);
            m_maxHealthPoints *= level;
            m_healthPoints    *= level;
        }
    }
Пример #2
0
    protected void UpdateRealtimeProperties()
    {
        float multiplierLevel;

        if (HasProperty(BacteriaProperty.Multiplier, out multiplierLevel))
        {
            if (Random.Range(0f, 1f) < (BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Multiplier, multiplierLevel) * Time.deltaTime))
            {
                Bacteria bacteria = Instantiate(this);
                bacteria.m_commandsQueue = new Queue <UnitCommands.UnitCommand>(m_commandsQueue);
                bacteria.transform.SetParent(transform.parent);
                BacteriasManager.singleton.AddBacteriaToInvasion(bacteria);
            }
        }
    }
Пример #3
0
    protected override void OnTakeDamage(Unit source, float damagesTaken)
    {
        if (dead)
        {
            return;
        }

        float berserkLevel;

        if (!m_isBerserk && HasProperty(BacteriaProperty.Berserker, out berserkLevel) && (m_healthPoints / m_maxHealthPoints) < 0.3f)
        {
            m_isBerserk   = true;
            m_attackRate /= BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Berserker, berserkLevel);
        }
    }
Пример #4
0
    protected override void OnDealDamage(Unit unit, float damagesDealt)
    {
        if (!unit || unit.dead)
        {
            return;
        }

        float killerLevel;

        if (HasProperty(BacteriaProperty.Killer, out killerLevel))
        {
            if (Random.Range(0f, 1f) < (BacteriasManager.BacteriaPropertyAtLevel(BacteriaProperty.Killer, killerLevel) * Time.deltaTime))
            {
                unit.Die(this);
            }
        }
    }
Пример #5
0
 private void Awake()
 {
     s_singleton = this;
     m_invasionsConfigurations = GetComponentsInChildren <BacteriaInvasionConfig>();
 }