Example #1
0
        public void UpdateTeleport(SActor actor)
        {
            if (actor.EndState <= Timing.sInstance.GetFrameStartTime())
            {
                actor.mActorController?.GetUnprocessedMoveList().Clear();

                actor.SetLocation(actor.TargetPos);
                LogHelper.LogInfo($"end teleport pos {actor.TargetPos.ToString()}, degree{actor.degree}");
                ChangeState(actor, UpdateIdle, ActorState.Idle, 0f);
            }
        }
Example #2
0
        public void UpdateDash(SActor actor)
        {
            if (actor.EndState <= Timing.sInstance.GetFrameStartTime())
            {
                actor.mActorController?.GetUnprocessedMoveList().Clear();

                actor.SetLocation(actor.TargetPos);
                actor.SetVelocity(Vector3.zero);
                Log.Information($"end dash pos {actor.TargetPos.ToString()}");
                ChangeState(actor, UpdateIdle, ActorState.Idle, 0f);
                NetworkManagerServer.sInstance.SetStateDirty(actor.GetNetworkId(), actor.WorldId, (uint)Actor.ReplicationState.Pose);
            }
        }
Example #3
0
        public void SpawnActorForPlayer(int inPlayerId, byte worldId)
        {
            SActor actor = (SActor)GameObjectRegistry.sInstance.CreateGameObject((uint32_t)GameObjectClassId.kActor, worldId);

            actor.SetColor(GameMode.sInstance.GetEntry((uint32_t)inPlayerId).GetColor());
            actor.SetPlayerId((uint32_t)inPlayerId);
            actor.Possess(inPlayerId);
            actor.SetWorldId(worldId);
            //gotta pick a better spawn location than this...
            actor.SetLocation(core.Utility.GetRandomVector(-10, 10, 0));

            Log.Information(string.Format("SpawnActorForPlayer player_id{0}, world{1}", inPlayerId, worldId));
        }
Example #4
0
        public void UpdateGhost(SActor actor)
        {
            if (actor.EndState <= Timing.sInstance.GetFrameStartTime())
            {
                actor.mActorController?.GetUnprocessedMoveList().Clear();

                actor.SetLocation(actor.TargetPos);
                actor.SetVelocity(Vector3.zero);
                actor.degree = actor.SpawnAngle;
                actor.HiddenMapObjects.Clear();
                actor.killPlayerId = 0;

                LogHelper.LogInfo($"end ghost pos {actor.TargetPos.ToString()}");
                ChangeState(actor, UpdateIdle, ActorState.Idle, 0f);
                NetworkManagerServer.sInstance.SetStateDirty(actor.GetNetworkId(), actor.WorldId, (uint)Actor.ReplicationState.Spawn);

                actor.AddSpellMySelf(core.BuffType.Invincible);
                World.Instance(actor.WorldId).GameMode.game_mode.OnTrigger(actor.WorldId, actor.GetPlayerId(), PlayPointID.PlayerReborn);
            }
        }
        public SActor SpawnActor(int inPlayerId, byte worldId, int team, int spawn_index)
        {
            SActor actor = (SActor)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Actor, true, worldId);

            var entry = World.Instance(worldId).GameMode.AddEntry(inPlayerId, this.mSessionId.ToString(), (ushort)team, spawn_index, actor.GetNetworkId());

            actor.SpawnPoint = World.spawn_position[entry.seat].mapPos;
            actor.SpawnAngle = new Vector2(World.spawn_position[entry.seat].startVector.x, World.spawn_position[entry.seat].startVector.z).Angle();
            actor.degree     = actor.SpawnAngle;
            actor.SetWorldId(worldId);
            actor.SetLocation(actor.SpawnPoint);
            actor.SetPhysics();
            actor.Team = entry.GetTeam();
            actor.SetPlayerId(inPlayerId);

            //gotta pick a better spawn location than this...

            //actor.SetLocation(core.Utility.GetRandomVector(-10, 10, 0));
            actor.SetCharacter(mSelectedCharacter, mCharacterLevel, UserId);

            Log.Information($"SpawnActor player_id{inPlayerId}, UserID:{actor.UserId}, network_id{actor.NetworkId}, world{worldId}, idx{entry.seat}, pos{actor.GetLocation()}, angle{actor.degree}, direction({World.spawn_position[entry.seat].startVector.x},{World.spawn_position[entry.seat].startVector.z})");

            return(actor);
        }