Exemplo n.º 1
0
        private void Awake()
        {
            FX    = GetComponent <General.SpawnFX>();
            BLEED = new List <Vector2>();
            RB    = GetComponent <Rigidbody2D>();
            pRB   = GetComponentInParent <Rigidbody2D>();
            if (pRB == null)
            {
                if (transform.parent != null)
                {
                    pRB = transform.parent.GetComponentInParent <Rigidbody2D>();
                }
            }
            CurrentHP = RealHP;
            CalculatePercent();
            if (!Global)
            {
                return;
            }
            //H = GetComponent<Humus>();

            //AI.AIBase a = GetComponent<AI.AIBase>();

            //Player p = GetComponent<Player>();

            HPS    = new List <Health>(GetComponentsInChildren <Health>(true));
            RealHP = 0;
            foreach (Health hp in HPS)
            {
                //Debug.Log("This is global, reporting " + hp.name);
                //maxHp += hp.HPmult * 100;
                if (hp != this)
                {
                    RealHP       += hp.RealHP;
                    hp.HpChanged += hps_Changed;
                    hp.OnDeath   += hps_OnDeath;
                }
            }
            CurrentHP = RealHP;
        }
Exemplo n.º 2
0
 private void Start()
 {
     MG = GetComponentInParent <MeleeGun>();
     FX = GetComponent <General.SpawnFX>();
 }