public virtual void FailedMinigame()
 {
     avatar.transform.parent.BroadcastMessage("OnMinigameFailed", this);
     failed();
     minigameStarted = false;
     avatar          = null;
 }
Beispiel #2
0
        public void Resurrect(IAvatar avatar)
        {
            avatar.SetBody(avatar.BodyMax);
            avatar.SetMind(avatar.MindMax);
            avatar.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Positive, "You have been resurrected!"));
            avatar.Context.AddRange(avatar.GetRdlProperties(
                                        Avatar.BodyProperty,
                                        Avatar.BodyMaxProperty,
                                        Avatar.MindProperty,
                                        Avatar.MindMaxProperty));

            this.Enter(avatar, Direction.Empty);
            // Don't want to send down the whole map. Just send down the zone.
            //avatar.Context.AddRange(this.World.GetRdlMap(avatar.X, avatar.Y));

            Character player = avatar as Character;

            if (player != null)
            {
                MapManager.MapDetail detail = this.World.Map.GetDetail(player.Location);
                if (detail != null)
                {
                    string zone = player.Properties.GetValue <string>(Character.ZoneProperty);
                    if (detail.Name != zone)
                    {
                        player.Properties.SetValue(Character.ZoneProperty, detail.Name);
                        player.Context.Add(new RdlProperty(player.ID, Character.ZoneProperty, zone));
                    }
                }
            }
        }
    void Awake()
    {
        comparer = SkeletonComparer.GetComparer(CurveProvider.Curve);

        UserAvatar      = UserRiggedAvatar as IAvatar ?? UserNativeAvatar;
        TechniqueAvatar = TechniqueRiggedAvatar as IAvatar ?? TechniqueNativeAvatar;
    }
Beispiel #4
0
        internal void Dispose()
        {
            LoggedIn = false;

            ((AresTcpSocket)socket).Dispose();

            socket    = null;
            guid      = Guid.Empty;
            name      = null;
            orgname   = null;
            version   = null;
            region    = null;
            message   = null;
            avatar    = null;
            orgavatar = null;
            localip   = null;
            nodeip    = null;
            dnsentry  = null;

            counters.Clear();
            counters = null;

            files.Clear();
            files  = null;
            pfiles = null;

            ignored.Clear();
            ignored = null;

            extended_props.Clear();
            extended_props = null;
        }
 public virtual void QuitMinigame()
 {
     minigameStarted = false;
     avatar.transform.parent.BroadcastMessage("OnMinigameAborted", this);
     quit();
     avatar = null;
 }
Beispiel #6
0
    private void InitilizePlayer()
    {
        ulong userId = VrLifeCore.API.User.UserId.Value;

        _playerAvatar = new DefaultAvatar(userId, "Player", Vector3.zero, Quaternion.identity);
        _api.GlobalAPI.Players.AddMainAvatar(_playerAvatar);
    }
    public void Update()
    {
        if (!ShouldUpdate)
        {
            return;
        }
        if (actorClip != null && actingInScene.GetGameObject().GetComponent <AudioSource>().isPlaying)
        {
            return;
        }

        if (actorClip != null)
        {
            IAvatar avatar = actingInScene.GetMainAvatar();
            avatar.OnSubtitleStop();
        }
        if (customAnimation != null)
        {
            var currentAnimation = speakingActor.GetComponent <Animation>()[customAnimation.name];
            if (currentAnimation.normalizedTime < 1.0 && speakingActor.GetComponent <Animation>().IsPlaying(customAnimation.name))
            {
                return;
            }
        }
        Close();
    }
        public void Initialize()
        {
            IAvatar     mainAvatar = _avatarService.GetMain();
            IAvatarBody avatarBody = _avatarBodySystem.GetOrCreate(_mainAvatarBodyType);

            avatarBody.SetAvatar(mainAvatar);
        }
Beispiel #9
0
 public void AssignAvatar(IAvatar avatarToControl)
 {
     Debug.Log("Player: We have an avatar:" + avatarToControl.name);
     avatar        = avatarToControl;
     avatar.player = this;
     avatarToControl.playerNotifications = playerNotifications;
 }
Beispiel #10
0
        /// <summary>
        /// Exits the specified avatar from the current place.
        /// </summary>
        /// <param name="who">The avatar leaving the current place.</param>
        /// <param name="direction">The direction in which the avatar is leaving.</param>
        public void Exit(IAvatar who, Direction direction)
        {
            // Remove the actor from the current place.
            this.Children.Remove(who);

            // Raise the OnExit event on the current place.
            if (direction.KnownDirection != KnownDirection.None && !who.IsBuilder)
            {
                this.OnExit(who, who.Context, direction);

                if (who is IPlayer)
                {
                    (who as IPlayer).OnPlaceExited();
                }

                // Raise an event on all player instances in the current place that a new player has entered.
                var avatars = (from c in this.Children where c is IAvatar select c as IAvatar);
                foreach (var avatar in avatars)
                {
                    if (avatar.ID != who.ID)
                    {
                        avatar.OnExit(who, who.Context, direction);
                    }
                }
            }
        }
Beispiel #11
0
        private void World_AvatarKilledAvatar(IAvatar attacker, IAvatar defender)
        {
            int    index = Dice.Random(0, VictoryMessages.Length - 1);
            string msg   = String.Format(VictoryMessages[index], attacker.AUpper(), defender.A());

            Game.UpdateTwitter(Strings.EnsureProperSentence(msg));
        }
        private void CreatedRemotePlayer(IRemotePlayer remotePlayer, object args)
        {
            PlayerID pid = _infra.ResolvePlayerID(args);

            NetworkArgs nargs = null;

            if (args is object[] argList)
            {
                if (argList.Length >= 2)
                {
                    if (argList[1] is NetworkArgs result)
                    {
                        nargs = result;
                    }
                }
            }

            IAvatar avatar = GetOrCreateAvatar(pid, nargs);

            avatar.SetAvatarController(remotePlayer);

            remotePlayer.PlayerID = pid;
            remotePlayer.OnDestroyingRemotePlayer += HandleRemotePlayerDestroying;

            OnCreatedRemotePlayer?.Invoke(avatar, remotePlayer);
        }
Beispiel #13
0
    protected void PerformAction(IAvatar avatar)
    {
        DebugUtilities.Assert(actorScenePrefab != null, "You must have a valid actorScene for the action");
        var instantiatedScene = ActorSceneUtility.CreateSceneWithAvatarAndInteractable(actorScenePrefab.gameObject, avatar, gameObject);

        instantiatedScene.PlayScene(avatar.playerNotifications);
    }
Beispiel #14
0
        public async Task InsertOrUpdateAsync(IAvatar avatar)
        {
            using (var context = new EFContext())
            {
                if (avatar == null)
                    throw new ArgumentNullException(nameof(avatar));

                var oldAvatar = await context.Avatars
                    .FirstOrDefaultAsync(x => x.VkUserId == avatar.VkUserId
                                              && x.VkOwnerId == avatar.VkOwnerId
                                              && x.Size == avatar.Size);

                if (oldAvatar != null)
                {
                    oldAvatar.Url = avatar.Url;
                    oldAvatar.Content = avatar.Content;
                }
                else
                {
                    var newAvatar = new Avatar
                    {
                        Id = Guid.NewGuid(),
                        VkUserId = avatar.VkUserId,
                        VkOwnerId = avatar.VkOwnerId,
                        Url = avatar.Url,
                        Content = avatar.Content,
                        Size = avatar.Size
                    };

                    context.Avatars.Add(newAvatar);
                }

                await context.SaveChangesAsync();
            }
        }
Beispiel #15
0
 public override void ExecuteAction(IAvatar _avatar)
 {
     avatar = _avatar;
     inventoryBagCloseHandler.CreateAndPlay(GetComponent <AudioSource>().volume);
     Debug.Log("Closing inventory bag...");
     avatar.CloseInventoryBag();
 }
        public AvatarController(IAvatar avatar)
        {
            m_avatar         = avatar;
            m_avatarControls = new AvatarControls(int.MaxValue);

            avatar.NewMessage += avatar_NewMessage;
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dungeonId">Id of the dungeon to enter</param>
        /// <param name="avatar">Avatar which enters</param>
        /// <returns>Room Number of the start room</returns>
        public int?EnterDungeon(int dungeonId, IAvatar avatar)
        {
            //var roomId = ActiveDungeons.Find(x => x.DungeonId == dungeonId)?.Enter(avatar);
            var roomId = DungeonMockData.Dungeon.Enter(avatar);

            return(roomId);
        }
Beispiel #18
0
        public override void Cast(IAvatar caster, IActor target, CastResults results)
        {
            if (!String.IsNullOrEmpty(this.ItemTypeName))
            {
                Item item = this.World.CreateActor(Type.GetType(this.ItemTypeName), this.ItemName) as Item;
                if (item != null)
                {
                    if (caster is Character)
                    {
                        Container container = (caster as Character).GetFirstAvailableContainer(item);
                        if (container != null)
                        {
                            item.Drop(container);
                            item.Save();

                            caster.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                                    String.Format(Resources.ItemCreated, item.A())));
                        }
                        else
                        {
                            caster.Context.Add(new RdlErrorMessage(Resources.InventoryFull));
                        }
                    }
                    else
                    {
                        item.Drop(caster);
                    }
                }
                else
                {
                    caster.Context.Add(new RdlErrorMessage(Resources.CastFailed));
                }
            }
        }
Beispiel #19
0
        public override void Cast(IAvatar caster, IActor target, CastResults results)
        {
            IAvatar traveler = target as IAvatar;

            if (traveler != null)
            {
                Place place = this.World.FindPlace(new Point3(this.DestinationX, this.DestinationY, this.DestinationZ));
                if (place != null && place.HasExits())
                {
                    place.Enter(traveler, Direction.Empty);

                    if (Object.ReferenceEquals(caster, traveler))
                    {
                        caster.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                                String.Format(Resources.SpellTransported, place.Name)));
                    }
                    else
                    {
                        caster.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                                String.Format(Resources.SpellTransportedTarget, traveler.The(), place.Name)));
                        traveler.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                                  String.Format(Resources.SpellTransportedByTarget, place.Name)));
                    }
                }
                else
                {
                    this.NoAffect(caster);
                }
            }
            else
            {
                this.NoAffect(caster);
            }
        }
        public AvatarController(IAvatar avatar)
        {
            m_avatar = avatar;
            m_avatarControls = new AvatarControls(int.MaxValue);

            avatar.NewMessage += avatar_NewMessage;
        }
Beispiel #21
0
        public override void Cast(IAvatar caster, IActor target, CastResults results)
        {
            IAvatar defender = target as IAvatar;

            if (defender != null)
            {
                if (defender is PerenthiaMobile)
                {
                    defender = caster;
                }

                int power = this.Foci.Power + results.CastSuccessCount;
                defender.Attributes.ApplyAffect(this.StatName, power, this.Foci.Duration);
                defender.Context.AddRange(defender.Affects.ToRdl());
                if (Object.ReferenceEquals(caster, defender))
                {
                    caster.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                            String.Format(Resources.SpellStatGained, this.StatName, power)));
                }
                else
                {
                    caster.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                            String.Format(Resources.SpellStatGainedTarget, this.StatName, defender.A(), power)));
                    defender.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.Cast,
                                                              String.Format(Resources.SpellStatGainedByTarget, caster.A(), this.StatName, power)));
                    defender.Context.AddRange(defender.Attributes.ToRdl());
                }
            }
            else
            {
                this.NoAffect(caster);
            }
        }
Beispiel #22
0
        public static void SetTarget(this IAvatar avatar, IAvatar target)
        {
            // If the target's target is not null then check to see if the target's target is in the current
            // place, if not release the target.
            // Will not need to do this because mobiles are cloned.
            //IAvatar targetTarget = target.Target as IAvatar;
            //if (targetTarget != null)
            //{
            //    if (targetTarget.Location != target.Location)
            //    {
            //        target.Target = null;
            //    }
            //}

            avatar.Target = target;
            if (target != null)
            {
                target.Target = avatar;

                // Send notification to avatar.
                avatar.Context.AddRange(avatar.GetRdlProperties(Avatar.TargetIDProperty));
                avatar.Context.AddRange(target.ToSimpleRdl());
                avatar.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.None,
                                                        String.Format(Resources.TargetSet, target.A())));

                // Send notification to target
                target.Context.AddRange(target.GetRdlProperties(Avatar.TargetIDProperty));
                target.Context.AddRange(avatar.ToSimpleRdl());
                // Do not send a message to the target, not really needed.
                //target.Context.Add(new RdlSystemMessage(RdlSystemMessage.PriorityType.None,
                //    String.Format(Resources.TargetSet, avatar.A())));
            }
        }
    void Start()
    {
        IAvatar playbackAvatar = RiggedPlaybackAvatar as IAvatar ?? PlaybackAvatar;

        playbackAvatar.SwapSkeletonProvider(Playback);
        Playback.Reset();
    }
Beispiel #24
0
 private void Reset()
 {
     _mainAvatar.Destroy();
     _mainAvatar = null;
     _avatars.Values.ToList().ForEach(x => x.Destroy());
     _avatars.Clear();
 }
Beispiel #25
0
 public virtual void CompletedMinigame()
 {
     avatar.transform.parent.BroadcastMessage("OnMinigameDone", this);
     completed();
     minigameStarted = false;
     avatar          = null;
 }
 public UserAuthenticationService(IUserRepository userRepository, ISessionStateRepository sessionStateRepository, IFormsAuthenticationService formsAuthenticationService, IConfigurationRepository configurationRepository, IAvatar avatar)
 {
     UserRepository = userRepository;
     SessionStateRepository = sessionStateRepository;
     FormsAuthenticationService = formsAuthenticationService;
     ConfigurationRepository = configurationRepository;
     Avatar = avatar;
 }
Beispiel #27
0
 public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId)
 {
     m_rootScene = rootScene;
     //m_parent = self;
     m_location = location;
     //m_itemId = itemId;
     m_assetId = assetId;
 }
Beispiel #28
0
        public static void SetBodyAndMind(IAvatar avatar, World world)
        {
            int body = avatar.Attributes.Stamina * world.RealismMultiplier;
            int mind = avatar.Attributes.Endurance * world.PowerMultiplier;

            avatar.SetBody(body, body);
            avatar.SetMind(mind, mind);
        }
 public SPAvatarAttachment(IScene rootScene, IAvatar self, int location, UUID itemId, UUID assetId,
                           ISecurityCredential security)
 {
     m_rootScene = rootScene;
     m_security = security;
     m_location = location;
     m_assetId = assetId;
 }
Beispiel #30
0
 public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId)
 {
     m_rootScene = rootScene;
     m_parent    = self;
     m_location  = location;
     m_itemId    = itemId;
     m_assetId   = assetId;
 }
Beispiel #31
0
 /// <summary>Create <see cref="User"/>.</summary>
 /// <param name="repository">Related repository.</param>
 /// <param name="name">User name.</param>
 /// <param name="email">User email.</param>
 /// <param name="commits">Commit count.</param>
 internal User(Repository repository, string name, string email, int commits)
     : base(repository, name + "\n" + email)
 {
     _name    = name;
     _email   = email;
     _commits = commits;
     _avatar  = new Gravatar(email);
 }
Beispiel #32
0
 /// <summary>Create <see cref="User"/>.</summary>
 /// <param name="repository">Related repository.</param>
 /// <param name="name">User name.</param>
 /// <param name="email">User email.</param>
 /// <param name="commits">Commit count.</param>
 internal User(Repository repository, string name, string email, int commits)
     : base(repository, name + "\n" + email)
 {
     _name = name;
     _email = email;
     _commits = commits;
     _avatar = new Gravatar(email);
 }
 public override void ExecuteAction(IAvatar avatar)
 {
     if (avatar.avatarQuest.IsLookingFor(this))
     {
         avatar.transform.parent.BroadcastMessage("OnInteractWith", GetComponentInChildren <Interactable>());
     }
     vehicleToArbitrate.SetControllingAvatar(avatar);
 }
Beispiel #34
0
 public SPAvatarAttachment(IScene rootScene, IAvatar self, int location, UUID itemId, UUID assetId,
                           ISecurityCredential security)
 {
     m_rootScene = rootScene;
     m_security  = security;
     m_location  = location;
     m_assetId   = assetId;
 }
        private void HandleOnCreatedLocalPlayer(IAvatar avatar, IRemotePlayer remotePlayer)
        {
            ISpatialAnchor anchor = _anchorSystem.GetOrCreateAnchor(remotePlayer.PlayerID);

            _anchorSystem.CreateTuner();

            anchor.AddTransform(avatar.Root);
        }
    void Close()
    {
        IAvatar avatar = actingInScene.GetMainAvatar();

        avatar.OnSubtitleStop();
        StopFacialAnimation(speakingActor);
        ComponentDone();
    }
Beispiel #37
0
        public static void SetCurrent(IAvatar avatar)
        {
            if (_currentAvatar != null)
                _currentAvatar.CaptureMouse = false;

            _currentAvatar = avatar;
            _currentAvatar.CaptureMouse = true;
        }
Beispiel #38
0
        public static IAvatar AddAvatar(IAvatar avatar)
        {
            _avatars.Add(avatar);
            if (_avatars.Count == 1)
                SetCurrent(avatar);

            return avatar;
        }
 public void SetAvatarMotion(IAvatar avatar)
 {
     IForwardMovablePhysicalEntity physicalEntity = avatar.PhysicalEntity;
     Debug.Assert(physicalEntity != null, "physicalEntity != null");
     physicalEntity.ForwardSpeed = avatar.DesiredSpeed * MaximumSpeed;
     physicalEntity.RotationSpeed = avatar.DesiredLeftRotation * MathHelper.ToRadians(MaximumRotationSpeed);
     avatar.Rotation += physicalEntity.RotationSpeed;
 }
Beispiel #40
0
        public void AvatarCanPickUp()
        {
            Stream tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map map = serializer.Deserialize(tmxStream);
            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_avatarPickuper = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);
            m_avatarPickuper.PickUp = true;

            Assert.Equal(null, m_avatarPickuper.Tool);

            // Act
            m_avatarPickuper.Update(m_worldPickupWorld.Atlas, It.IsAny<TilesetTable>());

            // Assert
            Assert.IsType<Apple>(m_avatarPickuper.Tool);
            Assert.False(m_avatarPickuper.PickUp);
        }
 public Avatar()
 {
     InitializeComponent();
     _avatar = Factory.Get<IAvatar>();
     Image.DataContext = _avatar;
 }
        public AvatarControllerTests()
        {
            m_avatar = new Avatar("", 0, "Pingu", 0, Vector2.Zero, Vector2.One);

            m_avatarController = new AvatarController(m_avatar);
        }
 public GravatarHelperTest()
 {
     _hash = new Mock<IHash>();
     _gravatar = new Gravatar(_hash.Object);
 }
Beispiel #44
0
 public AvatarWrapper(IAvatar avatar)
 {
     m_avatar = avatar;
 }
Beispiel #45
0
        public void AvatarLoosingEnergy()
        {
            Stream tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map map = serializer.Deserialize(tmxStream);
            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_eater = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);

            // Act
            for (int i = 0; i < 100; i++)
            {
                m_eater.Update(m_worldPickupWorld.Atlas, It.IsAny<TilesetTable>());
            }

            // Assert
            Assert.True(m_eater.Energy < 1);
        }