Exemple #1
0
        void CheckHit(ColliderHitEvent hitEvent)
        {
            var otherEntity = hitEvent.HitCollider.GetComponent <Entity>();

            if (otherEntity != bulletComponent.Owner)
            {
                Debug.Log("Hit " + otherEntity);

                Entity.Destroy();
                otherEntity.Destroy();                 // todo CeresECL add health example
            }
        }
        void OnTriggerEnter2D(Collider2D other)
        {
            if (!entity)
            {
                return;
            }

            var hitEvent = new ColliderHitEvent
            {
                HitCollider = other
            };

            entity.Events.Add(hitEvent);
        }