示例#1
0
    public void OnTriggerEnter(Collider other)
    {
        var go = other.attachedRigidbody.gameObject;

        //Debug.Log($"Laser hit {go.name}");
        if (go.HasEntityTag(EntityTags.IsDamageable))
        {
            //Debug.Log($"Adding dmg component to ship");
            go.GetEntity().GetComponent <DamageComp>().damagePackets.Push(new DamagePacket(10, 10));
        }
        Explosions.Create(Res.Prefabs.ExplosionPFX_Blue, transform.position);
        gameObject.Release();
    }
        public override void Update()
        {
            var hcs = engine.Get(ComponentTypes.HullComp);

            for (int i = hcs.Count - 1; i >= 0; i--)
            {
                if (((HullComp)hcs[i]).CurrentHull <= 0)
                {
                    Explosions.Create(Res.Prefabs.Explosion_01, hcs[i].GetComponent <PositionComp>().Position);
                    engine.DestroyEntity(hcs[i].Owner);
                }
            }
        }
        private void OnParticleCollision(GameObject other)
        {
            if (NeedsDamageInit)
            {
                NeedsDamageInit = false;
                BuildDamagePacket();
            }
            //Debug.Log($"Creating explosion at: {other.transform.position}");

            //Debug.Log($"Laser hit {go.name}");
            if (other.HasEntityTag(EntityTags.IsDamageable))
            {
                //Debug.Log($"Adding dmg component to ship");
                //#TODO: Change damage packet to match weapon info
                other.GetEntity().GetComponent <DamageComp>().damagePackets.Push(particleDmgPacket);
            }
            Explosions.Create(Res.Prefabs.ExplosionPFX_Blue_Local, other.transform.position);
            //Debug.Break();
        }