コード例 #1
0
        public override void damage(ShapeBase obj, Point3F position, GameBase sourceobject, float damage,
                                    string damagetype)
        {
            Player pobj = obj._ID;

            if (!pobj.isObject() || pobj.getState() == "Dead" || !damage.AsBool())
            {
                return;
            }

            obj.applyDamage(damage);

            GameConnection client = obj["client"];

            if (!client.isObject())
            {
                return;
            }
            if (damagetype != "Suicide")
            {
                pobj.setDamageDirection(sourceobject, new TransformF(position));
            }

            if (pobj.getState() == "Dead")
            {
                client.onDeath(sourceobject, sourceobject["client"].isObject() ? sourceobject["client"] : "0",
                               damagetype, "Body");
            }
        }