示例#1
0
        private void OnTriggerStay(Collider other)
        {
            var pc = other.GetComponent <PlayerController>();

            if (pc != null && pc.IsMine)
            {
                CDamage msg = new CDamage();
                msg.entityId = pc.Entity.entityId;
                msg.decHP    = damageAmount;
                MyNetwork.Send(msg);
            }
        }
示例#2
0
        private void OnRecvDamage(IChannel channel, Message message)
        {
            CDamage  request  = message as CDamage;
            Creature creature = World.Instance.GetEntity(request.entityId) as Creature;

            if (creature == null)
            {
                return;
            }

            creature.OnHit(null, request.decHP);
        }
示例#3
0
        private void OnRecvDamage(IChannel channel, Message message)
        {
            CDamage  request  = message as CDamage;
            Creature creature = World.Instance.GetEntity(request.entityId) as Creature;

            if (creature == null)
            {
                return;
            }
            Console.WriteLine(string.Format("OnRecvDamage creature id {0:D}", request.entityId));
            creature.OnHit(null, request.decHP);
        }
示例#4
0
        void OnTriggerEnter(Collider other)
        {
            var pc = other.GetComponent <PlayerController>();

            if (pc != null && pc.IsMine)
            {
                CDamage msg = new CDamage();
                msg.entityId = pc.Entity.entityId;
                msg.decHP    = int.MaxValue;
                MyNetwork.Send(msg);
            }
            if (audio != null)
            {
                audio.transform.position = other.transform.position;
                if (!audio.isPlaying)
                {
                    audio.Play();
                }
            }
        }