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>(); }
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); }
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); } }
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); } }
void Awake() { _navMeshAgent = GetComponent <NavMeshAgent>(); _anim = GetComponent <CPlayerAnimation>(); _attack = GetComponent <CPlayerAttack>(); }