Пример #1
0
        public void SendAttackingAction()
        {
            CPlayerAttack action = new CPlayerAttack();

            action.player = m_entity.entityId;
            action.target = m_attackTarget;
            MyNetwork.Send(action);
        }
    private void Awake()
    {
        _rigidbody = GetComponent <Rigidbody>();
        _firePos   = GetComponentInChildren <FirePos>().gameObject;
        _attack    = GetComponent <CPlayerAttack>();

        _joyLeft  = GameObject.Find("Joystick L").GetComponent <FloatingJoystick>();
        _joyRight = GameObject.Find("Joystick R").GetComponent <FloatingJoystick>();
    }
Пример #3
0
        public void SendAttackingAction()
        {
            CPlayerAttack action = new CPlayerAttack();

            action.player = m_entity.entityId;
            action.target = m_attackTarget;
            Debug.Log(string.Format("SendAttackingAction {0:D}", m_attackTarget));
            MyNetwork.Send(action);
        }
Пример #4
0
        private void OnRecvPlayerAttack(IChannel channel, Message message)
        {
            CPlayerAttack request = message as CPlayerAttack;
            Player        player  = (Player)World.Instance.GetEntity(request.player);

            if (request.target != 0)
            {
                Creature target = World.Instance.GetEntity(request.target) as Creature;
                if (target != null)
                {
                    // player attack other creature
                    target.OnHit(player, 1);
                    player.OnAttack(target);
                }
            }
            else
            {
                player.OnAttack(null);
            }
        }
Пример #5
0
        private void OnRecvPlayerAttack(IChannel channel, Message message)
        {
            CPlayerAttack request = message as CPlayerAttack;
            Player        player  = (Player)World.Instance.GetEntity(request.player);

            //System.Console.WriteLine("Attacking");
            if (request.target != 0)
            {
                Creature target = World.Instance.GetEntity(request.target) as Creature;
                if (target != null)
                {
                    // player attack other creature
                    target.OnHit(player, player.attr_damage);
                    //  System.Console.WriteLine("Attack");
                    player.OnAttack(target);
                }
            }
            else
            {
                player.OnAttack(null);
            }
        }
Пример #6
0
 void Awake()
 {
     _navMeshAgent = GetComponent <NavMeshAgent>();
     _anim         = GetComponent <CPlayerAnimation>();
     _attack       = GetComponent <CPlayerAttack>();
 }