Exemplo n.º 1
0
        public static void PlayerSetTarget(GameObject target)
        {
            var livingEntityBhv = target.GetComponent <LivingEntityBehaviour>();

            if (livingEntityBhv == null)
            {
                return;
            }
            Selectors.RemoveSelector(SelectorType.TARGET);
            var targetEntity = livingEntityBhv.Entity;
            var entityType   = targetEntity.EntityType;

            if (entityType == EntityType.MONSTER)
            {
                UnityClient.Player.Target = targetEntity;
                UnityClient.TcpClient.Send(new EntityTargetPacket()
                {
                    WhoUuid    = UnityClient.Player.UID,
                    TargetUuid = UnityClient.Player.Target.UID
                });
                Selectors.AddSelector(target, SelectorType.TARGET, Color.red);
                var path = UnityClient.Map.FindPath(UnityClient.Player.Position, target.GetMapPosition());
                if (path != null)
                {
                    UnityClient.Player.Behaviour.Route = path;
                    Selectors.HideSelector();
                }
            }
        }
Exemplo n.º 2
0
        public static void PlayerSetTarget(GameObject target)
        {
            Selectors.RemoveSelector("targeted");
            var objType = FactoryMethods.GetType(target);

            if (objType == FactoryObjectTypes.MONSTER)
            {
                UnityClient.Player.Target = target;
                Selectors.AddSelector(target, "targeted", Color.red);
                var path = UnityClient.Map.FindPath(UnityClient.Player.Position, target.GetMapPosition());
                if (path != null)
                {
                    UnityClient.Player.FollowingPath = path;
                    Selectors.HideSelector();
                }
            }
        }