Пример #1
0
        private void OnHealthUpdate(object sender, HealthUpdateArgs args)
        {
            if (!(args.amount < 0)) return;

            StopAllCoroutines();
            StartCoroutine(Heal());
        }
Пример #2
0
        private void OnHit(object sender, HealthUpdateArgs args)
        {
            // already dead
            if (args.health <= 0f)
            {
                MyHealth.HealthUpdateEvent -= OnHit;
                return;
            }

            // next stage
            if (args.health < stages[CurrentStage - 1])
            {
                CurrentStage++;
                NextStageEvent(this, new ValueArgs(CurrentStage));
            }
        }
Пример #3
0
        private void OnDeath(object sender, HealthUpdateArgs args)
        {
            if (args.health > 0f) return;

            StopAllCoroutines();
            ((Health)GetComponent(typeof(Health))).HealthUpdateEvent -= OnDeath;

            float angle = 360f / pieceCount;
            for (int i = 0; i < pieceCount; i++)
            {
                GameObject piece = Prefabs.Pop(planetPieces, myTransform.position, myTransform.rotation, pieceLife);
                piece.transform.localScale = myTransform.localScale;
                ((Hitbox)piece.GetComponent(typeof(Hitbox))).Initialize(this.sender, damage / pieceCount, pieceLife, Utility.RotateVector(myTransform.forward, angle * i, Vector3.back) * pieceSpeed);
            }
            myPoolObject.Disable();
        }