예제 #1
0
        private static string GetRowData(FollowData model, int counter)
        {
            switch (counter)
            {
            case 1:
            {
                var cleanedName = CleanInput(model.FollowName);
                return(cleanedName);
            }

            case 2: return(model.FollowPageAddress);

            case 3: return(model.SameFollowCount.ToString());

            case 4:
            {
                string followerNames = string.Empty;
                foreach (var item in model.SameFollowPeople)
                {
                    followerNames += $"{item}, ";
                }

                return(followerNames);
            }
            }
            return(null);
        }
예제 #2
0
 public MainCameraFollowState(MonoMainCamera camera) : base(camera)
 {
     this.anchorRadius                 = 6f;
     this.cameraLocateRatio            = 0.535f;
     this.posLerpRatio                 = 1f;
     this.forwardLerpRatio             = 1f;
     base.lerpDirectionalLight         = true;
     this.followData                   = new FollowData();
     this.rotateToAvatarFacingState    = new FollowRotateToAvatarFacing(this);
     this.standByState                 = new FollowStandBy(this);
     this.lookAtPositionState          = new FollowLookAtPosition(this);
     this.rangeTransitState            = new FollowRangeTransit(this);
     this.timedPullZState              = new FollowTimedPullZ(this);
     this.suddenChangeState            = new FollowSuddenChange(this);
     this.suddenRecoverState           = new FollowSuddenRecover(this);
     this.slowMotionKillState          = new FollowSlowMotionKill(this);
     this.followAvatarState            = new FollowAvatarPoleState(this);
     this.followAvatarAndTargetState   = new FollowAvatarAndTargetState(this);
     this.followAvatarAndBossState     = new FollowAvatarAndBossState(this);
     this.followAvatarAndCrowdState    = new FollowAvatarAndCrowdState(this);
     this.followAvatarControlledRotate = new FollowAvatarControlledRotate(this);
     this.recoverState                 = new FollowRecovering(this);
     this.anchorRadius                 = 6f;
     this.followCenterY                = 1.2f;
     this.anchorElevation              = MainCameraData.CAMERA_DEFAULT_ELEVATION_DEGREE;
     this.forwardDeltaAngle            = 0f;
     base.cameraFOV = this.mainCamera.originalFOV;
     this.recoverState.SetupRecoverRadius(this.anchorRadius);
     this.recoverState.SetupRecoverCenterY(this.followCenterY);
     this.recoverState.SetupRecoverElevation(this.anchorElevation);
     this.recoverState.SetupRecoverForwardDelta(this.forwardDeltaAngle);
     this.recoverState.SetupRecoverLerpPosRatio(1f);
     this.recoverState.SetupRecoverLerpForwardRatio(1f);
     this.recoverState.SetupRecoverFOV(base.cameraFOV);
 }
예제 #3
0
        private IEnumerator Start()
        {
            yield return(null);

            yield return(null);

            Debug.LogFormat("sizeof(FollowData)={0}", Marshal.SizeOf <FollowData>());

            followers = new Transform[m_FollowerRoot.childCount];
            for (int i = 0; i < followers.Length; ++i)
            {
                followers[i] = m_FollowerRoot.GetChild(i);
            }

            int bufferSize = (int)Math.Ceiling((m_SampleRate + 1) * m_FollowerDelay * followers.Length);

            positionBuffer = new RingBuffer <FollowData>(bufferSize, RingBufferMode.Overwrite);
            Debug.LogFormat("{0} followers, sample rate {1}, buffer size {2}", followers.Length, m_SampleRate, positionBuffer.Capacity);
            currentTime = 0;

            {
                FollowData data = new FollowData()
                {
                    Position  = transform.position,
                    Timestamp = 0,
                    Duration  = 1f / m_SampleRate
                };

                positionBuffer.PushFront(data);
            }
        }
예제 #4
0
    protected override void Setup(ICharacter character)
    {
        character.ActionList.ClearActions();

        FollowData followData = new FollowData(character);

        FlyAIAction.FollowData = followData;

        ConditionalComboAIAction <AttackAIAction> attackComboAIAction = new ConditionalComboAIAction <AttackAIAction> {
            Action     = AttackAIAction,
            ActionList = new AIActionList(character, character.ActionList.PoolerRepository),
            ExecuteAll = false
        };

        attackComboAIAction.ActionList.AddAction(SetGravityScaleAIAction);

        ConditionalComboAIAction <FlyAIAction> flyComboAIAction = new ConditionalComboAIAction <FlyAIAction> {
            Action     = FlyAIAction,
            ActionList = new AIActionList(character, character.ActionList.PoolerRepository),
            ExecuteAll = false
        };

        flyComboAIAction.ActionList.AddAction(SetGravityScaleAIAction);

        character.ActionList.AddAction(new ExecuteDataAIAction {
            FollowData = followData
        });
        character.ActionList.AddAction(attackComboAIAction);
        character.ActionList.AddAction(flyComboAIAction);
        character.ActionList.AddAction(FlyAIAction.PatrolAIAction);
        character.ActionList.AddAction(SetAnimationAIAction);
    }
예제 #5
0
        private void Update()
        {
            if (followers == null)
            {
                return;
            }

            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.z = 10;
                Vector3 target = Camera.main.ScreenToWorldPoint(mousePos);
                target.z = transform.position.z;

                float lerp = 1.0f - (float)Math.Exp(-m_LerpStrength * Time.deltaTime);
                transform.position = Vector3.Lerp(transform.position, target, lerp);
            }

            float prevTime = currentTime;
            float nextTime = currentTime + Time.deltaTime;

            int prevSampleCount = (int)(prevTime * m_SampleRate);
            int nextSampleCount = (int)(nextTime * m_SampleRate);

            if (prevSampleCount < nextSampleCount)
            {
                FollowData data = new FollowData()
                {
                    Position  = transform.position,
                    Timestamp = (float)nextSampleCount / m_SampleRate,
                    Duration  = (float)(nextSampleCount - prevSampleCount) / m_SampleRate
                };

                positionBuffer.PushFront(data);
            }

            currentTime = nextTime;

            float minSep = 1f / m_SampleRate;

            for (int i = 0; i < followers.Length; ++i)
            {
                Transform follower        = followers[i];
                float     targetTimestamp = currentTime - minSep - m_FollowerDelay * (i + 1);
                int       posIdx          = positionBuffer.BinarySearch(targetTimestamp, Finder, SearchFlags.IsReversed);
                if (posIdx >= 0 && posIdx < positionBuffer.Count - 1)
                {
                    ref FollowData target = ref positionBuffer[posIdx];
                    ref FollowData prev   = ref positionBuffer[posIdx + 1];
                    float          lerp   = (targetTimestamp - prev.Timestamp) / target.Duration;
                    // Debug.LogFormat("Following {0}:{1}", i, posIdx);
                    Vector3 positionTarget = Vector3.Lerp(prev.Position, target.Position, lerp);
                    positionTarget.z  = transform.position.z;
                    follower.position = positionTarget;
                    follower.gameObject.SetActive(true);
                }
    protected override void Setup(ICharacter character)
    {
        character.ActionList.ClearActions();

        FollowData followData = new FollowData(character);

        CharacterInputFollowAIAction.FollowData = followData;

        character.ActionList.AddAction(AttackAIAction);
        character.ActionList.AddAction(CharacterInputFollowAIAction);
    }
    protected override void Setup(ICharacter character) {
        character.ActionList.ClearActions();

        FollowData followData = new FollowData(character);
        SpiderAIAction.FollowData = followData;
        CharacterInputFollowAIAction.FollowData = followData;

        character.ActionList.AddAction(new ExecuteDataAIAction {
            FollowData = followData
        });
        character.ActionList.AddAction(AttackAIAction);
        character.ActionList.AddAction(SpiderAIAction);
        character.ActionList.AddAction(CharacterInputFollowAIAction);
        character.ActionList.AddAction(SetAnimationAIAction);
    }
예제 #8
0
        public List <FollowData> FollowList()
        {
            List <FollowData> followList = new List <FollowData>();

            this.Open();

            int recordCount = this.RetrieveRecords();

            this.MoveFirst();

            for (int x = 1; x <= recordCount; x++)
            {
                FollowData followData = new FollowData(this, x);
                followList.Add(followData);
            }

            return(followList);
        }
예제 #9
0
        public void WriteProfile(FollowData rowValue)
        {
            if (rowValue == null)
            {
                return;
            }


            var data = new List <object> {
                rowValue.EmailAddress ?? "", rowValue.TwitterUsername, rowValue.NumOfFollowers
            };

            var sheetService = new SheetsService(new Google.Apis.Services.BaseClientService.Initializer()
            {
                HttpClientInitializer = _GetCredential(),
                ApplicationName       = _appName
            });

            var range = "A2:C";

            var valueInputOption = SpreadsheetsResource.ValuesResource.AppendRequest.ValueInputOptionEnum.RAW;
            var insertOption     = SpreadsheetsResource.ValuesResource.AppendRequest.InsertDataOptionEnum.INSERTROWS;

            ValueRange body = new ValueRange();

            body.MajorDimension = "ROWS";
            body.Range          = range;
            body.Values         = new List <IList <object> > {
                data
            };

            SpreadsheetsResource.ValuesResource.AppendRequest request = sheetService.Spreadsheets.Values.Append(body, _spreadSheetId, range);

            request.ValueInputOption = valueInputOption;

            request.InsertDataOption = insertOption;

            AppendValuesResponse response = request.Execute();
        }
예제 #10
0
    public override void Initialize(System.IO.BinaryReader reader, RecordHeader header)
    {
        while (reader.BaseStream.Position < header.DataEndPos)
        {
            var type = (SubRecordType)reader.ReadInt32();
            var size = reader.ReadInt32();

            switch (type)
            {
            case SubRecordType.Id:
                name = reader.ReadString(size);
                break;

            case SubRecordType.Model:
                model = reader.ReadString(size);
                break;

            case SubRecordType.Name:
                fullName = reader.ReadString(size);
                break;

            case SubRecordType.RaceName:
                race = Record.GetRecord <Race>(reader.ReadString(size));
                break;

            // Npc's have this even if they are part of no faction, so it needs to be checked if empty first
            case SubRecordType.Anam:
                string fac = reader.ReadString(size);
                faction = string.IsNullOrEmpty(fac) ? null : faction = Record.GetRecord <Faction>(fac);
                break;

            case SubRecordType.BodyName:
                head = BodyPartRecord.Get(reader.ReadString(size));
                break;

            case SubRecordType.CreatureName:
                classId = Record.GetRecord <ClassRecord>(reader.ReadString(size));
                break;

            case SubRecordType.KeyName:
                hair = BodyPartRecord.Get(reader.ReadString(size));
                break;

            case SubRecordType.NpcData:
                npcData = new NpcRecordData(reader, size);
                break;

            case SubRecordType.Flag:
                npcFlags = (NpcFlags)reader.ReadInt32();
                break;

            case SubRecordType.InventoryItem:
                items.Add(new InventoryItem(reader));
                break;

            case SubRecordType.NpcSpell:
                spells.Add(Record.GetRecord <SpellRecord>(reader.ReadString(size)));
                break;

            case SubRecordType.AiData:
                aiData = new AiData(reader);
                break;

            case SubRecordType.AiWanderData:
                wanderData = new WanderData(reader);
                break;

            case SubRecordType.AiTravelData:
                travelData = new TravelData(reader);
                break;

            case SubRecordType.AiFollowData:
                followData = new FollowData(reader);
                break;

            case SubRecordType.AiEscortData:
                escortData = new EscortData(reader);
                break;

            case SubRecordType.ContainerData:
                cellEscortFollow = reader.ReadString(size);
                break;

            case SubRecordType.AiActivateData:
                activateData = new ActivateData(reader);
                break;

            case SubRecordType.DoorData:
                destinationData.Add(DoorExitData.Create(reader));
                break;

            case SubRecordType.DoorName:
                destinations.Add(reader.ReadString(size));
                break;

            case SubRecordType.Scale:
                scale = reader.ReadSingle();
                break;

            case SubRecordType.Script:
                script = Script.Get(reader.ReadString(size));
                break;
            }
        }
    }
예제 #11
0
    public override void Initialize(System.IO.BinaryReader reader, RecordHeader header)
    {
        while (reader.BaseStream.Position < header.DataEndPos)
        {
            var type = (SubRecordType)reader.ReadInt32();
            var size = reader.ReadInt32();

            switch (type)
            {
            case SubRecordType.Id:
                name = reader.ReadString(size);
                break;

            case SubRecordType.Model:
                model = reader.ReadString(size);
                break;

            case SubRecordType.Name:
                fullName = reader.ReadString(size);
                break;

            case SubRecordType.Script:
                script = Script.Get(reader.ReadString(size));
                break;

            case SubRecordType.AiData:
                aiData = new AiData(reader);
                break;

            case SubRecordType.AiActivateData:
                activateData = new ActivateData(reader);
                break;

            case SubRecordType.AiEscortData:
                escortData = new EscortData(reader);
                break;

            case SubRecordType.AiFollowData:
                followData = new FollowData(reader);
                break;

            case SubRecordType.AiTravelData:
                travelData = new TravelData(reader);
                break;

            case SubRecordType.AiWanderData:
                wanderData = new WanderData(reader);
                break;

            case SubRecordType.CreatureName:
                soundGeneratorName = reader.ReadString(size);
                break;

            case SubRecordType.InventoryItem:
                items.Add(new InventoryItem(reader));
                break;

            case SubRecordType.NpcSpell:
                spells.Add(Record.GetRecord <SpellRecord>(reader.ReadString(size)));
                break;

            case SubRecordType.Scale:
                scale = reader.ReadSingle();
                break;

            case SubRecordType.NpcData:
                data = new CreatureData(reader);
                break;

            case SubRecordType.Flag:
                flags = (CreatureFlags)reader.ReadInt32();
                break;
            }
        }

        // Use the record id for sound generation if no SoundGeneratorName is specified
        if (soundGeneratorName == null)
        {
            soundGeneratorName = name;
        }
    }