Example #1
0
 public DatabaseInfoData(string _Version, int _PlayerId)
 {
     this.Id                = 1; // Only one record
     this.Version           = _Version;
     this.PlayerId          = _PlayerId;
     this.CreationTimestamp = GenericUtilities.GetTimestampForNow();
 }
Example #2
0
 public LogInfoData(string _Session, InfoEvent _Event, string _Parameters)
 {
     this.Session    = _Session;
     this.Event      = _Event;
     this.Parameters = _Parameters;
     this.Timestamp  = GenericUtilities.GetTimestampForNow();
 }
 public void StopLeadingHorseByReins(Player player)
 {
     player.UnequipEquippedItem();
     horse.horseBehavior.PutHorseOnLead(false);
     headGear.anim.Play("OnHorse");
     GenericUtilities.EnableAllColliders(transform, true);
 }
Example #4
0
 private void Update()
 {
     hpText.text  = Mathf.CeilToInt(LocalInfo.PlayerHealth).ToString();
     hpText.color = TextGradient.Evaluate(GenericUtilities.ToPercent01(0, 100, LocalInfo.PlayerHealth));
     HealthBar.GetComponent <Image>().color = HpGradient.Evaluate(GenericUtilities.ToPercent01(0, 100, LocalInfo.PlayerHealth));
     hpBarParent.localScale = new Vector3(Mathf.Clamp(LocalInfo.PlayerHealth, 0, 100) / 100, hpBarParent.localScale.y, hpBarParent.localScale.z);
 }
 public LogLearnData(string _Session, string _PlaySession, MiniGameCode _MiniGame, DbTables _table, string _elementId, float _score)
 {
     this.Session     = _Session;
     this.PlaySession = _PlaySession;
     this.MiniGame    = _MiniGame;
     this.TableName   = _table.ToString();
     this.ElementId   = _elementId;
     this.Score       = _score;
     this.Timestamp   = GenericUtilities.GetTimestampForNow();
 }
        private void AddCoveringGuard(GuardStateBrainPBT guard)
        {
            GenericUtilities.SafelyAddItemToList(guard, _coveringGuards);

            // old implementation reliant on searchmodebehaviour
            // guard.GetComponent<SearchModeBehaviour>().InitSearch(
            //     this, _searchTrack.Exits[_assignedExitIndex]
            // );
            _assignedExitIndex++;
        }
Example #7
0
        public List <float> GetLatestScoresForMiniGame(MiniGameCode minigameCode, int nLastDays)
        {
            int    fromTimestamp = GenericUtilities.GetRelativeTimestampFromNow(-nLastDays);
            string query         = string.Format("SELECT * FROM LogPlayData WHERE MiniGame = '{0}' AND Timestamp < {1}",
                                                 (int)minigameCode, fromTimestamp);
            List <LogPlayData> list   = dbManager.FindLogPlayDataByQuery(query);
            List <float>       scores = list.ConvertAll(x => x.Score);

            return(scores);
        }
Example #8
0
 public LogPlayData(string _Session, string _PlaySession, MiniGameCode _MiniGame, PlayEvent _PlayEvent, PlaySkill _PlaySkill, float _Score, string _RawData)
 {
     this.Session     = _Session;
     this.PlaySession = _PlaySession;
     this.MiniGame    = _MiniGame;
     this.PlayEvent   = _PlayEvent;
     this.PlaySkill   = _PlaySkill;
     this.Score       = _Score;
     this.RawData     = _RawData;
     this.Timestamp   = GenericUtilities.GetTimestampForNow();
 }
    private void PutOnBridle(Player player)
    {
        headGear = player.currentlyEquippedItem.GetComponent <HorseGear> ();
        player.UnequipEquippedItem();

        headGear.transform.position = bridleTransform.position;
        headGear.transform.rotation = bridleTransform.rotation;
        headGear.transform.SetParent(bridleTransform);
        headGear.anim.Play("OnHorse");
        GenericUtilities.EnableAllColliders(headGear.transform, false);
    }
Example #10
0
        public Response ConvertData(string Name, float Number)
        {
            var response = new Response()
            {
                Name       = Name,
                NumberName = GenericUtilities.ConvertNumberToWords(Number),
                success    = true
            };

            return(response);
        }
Example #11
0
 void Start()
 {
     foreach (var enumValue in GenericUtilities.SortEnums <MiniGameCode>())
     {
         MiniGameCode code  = enumValue;
         var          btnGO = Instantiate(buttonPrefab);
         btnGO.transform.SetParent(this.transform);
         btnGO.GetComponentInChildren <Text>().text = (enumValue.ToString()).Replace("_", "\n");
         btnGO.GetComponent <Button>().onClick.AddListener(() => { tester.SimulateMiniGame(code); });
     }
     Destroy(buttonPrefab);
 }
        public void TestInsertLogMoodData()
        {
            var newData = new LogMoodData();

            newData.Session   = UnityEngine.Random.Range(0, 10).ToString();
            newData.Timestamp = GenericUtilities.GetTimestampForNow();

            newData.MoodValue = RND.Range(0, 20);

            this.dbManager.Insert(newData);
            PrintOutput("Inserted new LogMoodData: " + newData.ToString());
        }
        public void Teacher_LastNMoods()
        {
            var list = teacherAI.GetLastMoodData(10);

            string output = "Latest 10 moods:\n";

            foreach (var data in list)
            {
                output += GenericUtilities.FromTimestamp(data.Timestamp) + ": " + data.ToString() + "\n";
            }
            PrintOutput(output);
        }
        public void Teacher_ScoreHistoryCurrentJourneyPosition()
        {
            var list = teacherAI.GetScoreHistoryForCurrentJourneyPosition();

            string output = "Score history for the current journey position (" + playerProfile.CurrentJourneyPosition.ToString() + ") in the PlayerProfile:\n";

            foreach (var data in list)
            {
                output += GenericUtilities.FromTimestamp(data.Timestamp) + ": " + data.Score + "\n";
            }
            PrintOutput(output);
        }
    public void LeadIsDropped(Player player)
    {
        headGearAttachment.anim.Play("Hanging");
        headGearAttachment.transform.position = leadTransformHanging.position;
        headGearAttachment.transform.rotation = leadTransformHanging.rotation;
        headGearAttachment.transform.SetParent(leadTransformHanging);
        StopLeadingHorse(player);

        //set lead and halter colliders to disabled again, bc they get enabled along with horse colliders when dropping the lead
        GenericUtilities.EnableAllColliders(headGear.transform, false);
        GenericUtilities.EnableAllColliders(headGearAttachment.transform, false);
    }
    private void PutOnLead(Player player)
    {
        headGearAttachment = player.currentlyEquippedItem.GetComponent <HorseGear> ();

        player.UnequipEquippedItem();

        headGearAttachment.transform.position = leadTransformLeading.position;
        headGearAttachment.transform.rotation = leadTransformLeading.rotation;
        headGearAttachment.transform.SetParent(leadTransformLeading);
        GenericUtilities.EnableAllColliders(headGearAttachment.transform, false);

        StartLeadingHorse(player);
    }
        public void TestInsertLogInfoData()
        {
            var newData = new LogInfoData();

            newData.Session   = UnityEngine.Random.Range(0, 10).ToString();
            newData.Timestamp = GenericUtilities.GetTimestampForNow();

            newData.Event      = InfoEvent.Book;
            newData.Parameters = "test:1";

            this.dbManager.Insert(newData);
            PrintOutput("Inserted new LogInfoData: " + newData.ToString());
        }
 public void TieHorseToPost(Player player)
 {
     StopLeadingHorse(player);
     player.UnequipEquippedItem();
     headGearAttachment.anim.Play("Tied");
     transform.SetParent(player.nearestInteractable.transform);
     transform.localPosition = positionOnPost;
     headGearAttachment.transform.position = leadTransformTied.position;
     headGearAttachment.transform.rotation = leadTransformTied.rotation;
     headGearAttachment.transform.SetParent(leadTransformTied);
     horse.horseBehavior.TieHorseToPost(true);
     GenericUtilities.EnableAllColliders(transform, true);
 }
    public void Dismount(Player player)
    {
        player.UnequipEquippedItem();
        horse.horseBehavior.RidingHorse(false);
        player.transform.position             = playerLeadingPos.position;
        player.transform.rotation             = playerLeadingPos.rotation;
        player.playerModel.transform.position = player.transform.position;
        player.playerModel.transform.rotation = player.transform.rotation;

        player.playerModel.transform.SetParent(player.transform);

        //enable all colliders (but only trigger really matters, right?
        GenericUtilities.EnableAllColliders(transform, true);
    }
    private void PutOnSaddleAndPad(Player player)
    {
        backGear = player.currentlyEquippedItem.GetComponent <HorseGear> ();

        backGear.girth.position = backGear.girthPosOnHorse.position;
        backGear.girth.rotation = backGear.girthPosOnHorse.rotation;

        player.UnequipEquippedItem();

        backGear.transform.position = saddleTransform.position;
        backGear.transform.rotation = saddleTransform.rotation;
        backGear.transform.SetParent(saddleTransform);
        GenericUtilities.EnableAllColliders(backGear.transform, false);
    }
        public void TestInsertScoreData()
        {
            int      rndTableValue = RND.Range(0, 7);
            DbTables rndTable      = DbTables.Letters;
            string   rndId         = "";

            switch (rndTableValue)
            {
            case 0:
                rndTable = DbTables.Letters;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllLetterData()).GetId();
                break;

            case 1:
                rndTable = DbTables.Words;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllWordData()).GetId();
                break;

            case 2:
                rndTable = DbTables.Phrases;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllPhraseData()).GetId();
                break;;

            case 3:
                rndTable = DbTables.MiniGames;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllMiniGameData()).GetId();
                break;

            case 4:
                rndTable = DbTables.PlaySessions;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllPlaySessionData()).GetId();
                break;

            case 5:
                rndTable = DbTables.Stages;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllStageData()).GetId();
                break;

            case 6:
                rndTable = DbTables.Rewards;
                rndId    = RandomHelper.GetRandom(dbManager.GetAllRewardData()).GetId();
                break;
            }

            var lastAccessTimestamp = GenericUtilities.GetRelativeTimestampFromNow(-RND.Range(0, 5));
            var score = RND.Range(0f, 1f);

            this.dbManager.Debug_UpdateScoreData(rndTable, rndId, score, lastAccessTimestamp);
            PrintOutput("Inserted (or replaced) new ScoreData: " + lastAccessTimestamp.ToString());
        }
        public void AddSearchingGuard(GuardStateBrainPBT guard)
        {
            if (_searchingInProgress)
            {
                guard.SearchPoint = GetNextSearchPoint();
            }

            GenericUtilities.SafelyAddItemToList(guard, _searchingGuards);
            // if (_searchTrack.Exits.Count > 0)
            // {
            //     guard.GetComponent<SearchModeBehaviour>().InitSearch(
            //         this, _searchTrack.Exits[0]
            // );
            // }
        }
Example #23
0
        public void OnEnable()
        {
            m_classList.Window = Window;
            m_classList.OnEnable();

            m_bodyEditor.Window = Window;
            m_bodyEditor.OnEnable();

            m_classList.SelectionChanged += label => { m_bodyEditor.Set(label?.Source); };

            foreach (var charClass in GenericUtilities.FindAllDerivedTypes <CharacterClass>())
            {
                m_classList.Add((CharacterClass)System.Activator.CreateInstance(charClass));
            }
        }
        public void TestInsertLogPlayData()
        {
            var newData = new LogPlayData();

            newData.Session   = UnityEngine.Random.Range(0, 10).ToString();
            newData.Timestamp = GenericUtilities.GetRelativeTimestampFromNow(-RND.Range(0, 5));

            newData.PlaySession = "1.1.1";
            newData.MiniGame    = MiniGameCode.Balloons_counting;
            newData.Score       = RND.Range(0, 1f);
            newData.PlayEvent   = RND.value > 0.5f ? PlayEvent.GameFinished : PlayEvent.Skill;
            newData.PlaySkill   = PlaySkill.Logic;
            newData.RawData     = "TEST";

            this.dbManager.Insert(newData);
            PrintOutput("Inserted new LogPlayData: " + newData.ToString());
        }
Example #25
0
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        float x = Input.GetAxis("Horizontal");      // X- = A ,X+ = D
        float z = Input.GetAxis("Vertical");        // Z- = S ,Z+ = W

        Vector3 move = transform.right * x + transform.forward * z;

        if (move.magnitude > 1)
        {
            move.Normalize();
        }
        controller.Move(move.normalized * move.magnitude *
                        Lerp(speed * CrouchedPlayerSpeedFactor, speed, GenericUtilities.ToPercent01(CrouchedHeight, UprightHeight, HeightBuffer)) * Time.deltaTime);

        if (InputManager.GetBindDown("Jump") && isGrounded && !LocalInfo.IsPaused)
        {
            velocity.y = Sqrt(jumpForce * -2 * gravity);
            if (anim != null)
            {
                anim.Jump = true;
            }
        }
        controller.Move(velocity * Time.deltaTime);

        if (InputManager.GetBindDown("Crouch"))
        {
            stamina -= StaminaLossPerCrouch;
        }

        if (InputManager.GetBind("Crouch"))
        {
            SetHeightBuffer(Clamp(HeightBuffer - ((CrouchSpeedMultiplier * 5) * Time.deltaTime * stamina), CrouchedHeight, UprightHeight));
            stamina = Clamp01(stamina + (StaminaGainPerSecond / 3) * Time.deltaTime);
        }
        else
        {
            SetHeightBuffer(Clamp(HeightBuffer + ((CrouchSpeedMultiplier * 5) * Time.deltaTime), CrouchedHeight, UprightHeight));
            stamina = Clamp01(stamina + StaminaGainPerSecond * Time.deltaTime);
        }
    }
        public void TestInsertLogLearnData()
        {
            var newData = new LogLearnData();

            newData.Session   = UnityEngine.Random.Range(0, 10).ToString();
            newData.Timestamp = GenericUtilities.GetTimestampForNow();

            newData.PlaySession = "1.1.1";
            newData.MiniGame    = MiniGameCode.Assessment_LetterShape;

            bool useLetter = RND.value > 0.5f;

            newData.TableName = useLetter ? "LetterData" : "WordData";
            newData.ElementId = useLetter
                ? RandomHelper.GetRandom(dbManager.GetAllLetterData()).GetId()
                : RandomHelper.GetRandom(dbManager.GetAllWordData()).GetId();

            newData.Score = RND.Range(-1f, 1f);

            this.dbManager.Insert(newData);
            PrintOutput("Inserted new LogLearnData: " + newData.ToString());
        }
    private void PutOnHalterAndLead(Player player)
    {
        //store this here so that I can still access it once it's been unequipped
        Equippable combinedEquippable = player.currentlyEquippedItem;

        foreach (Transform child in player.currentlyEquippedItem.transform)
        {
            Debug.Log("equipping " + child);
            horseGearType type = child.GetComponent <HorseGear> ().type;

            switch (type)
            {
            case horseGearType.HALTER:
                headGear = child.GetComponent <HorseGear> ();

                headGear.transform.position = halterTransform.position;
                headGear.transform.rotation = halterTransform.rotation;
                GenericUtilities.EnableAllColliders(headGear.transform, false);
                break;

            case horseGearType.LEAD:
                headGearAttachment = child.GetComponent <HorseGear> ();

                headGearAttachment.transform.position = leadTransformLeading.position;
                headGearAttachment.transform.rotation = leadTransformLeading.rotation;
                GenericUtilities.EnableAllColliders(headGearAttachment.transform, false);
                break;
            }
        }

        headGear.transform.SetParent(halterTransform);
        headGearAttachment.transform.SetParent(leadTransformLeading);

        player.UnequipEquippedItem();

        combinedEquippable.transform.SetParent(headGear.transform);
        StartLeadingHorse(player);
    }
        public static Int32 Main(String[] args)
        {
            PortScannerOptions optionsParser = new PortScannerOptions();
            List <String>      nonOptionArgs = optionsParser.Parse(args);

            if (nonOptionArgs.Count < 3)
            {
                Console.WriteLine("Please give the remote-host, minPort and maxPort");
                optionsParser.PrintUsage();
                return(-1);
            }
            else if (nonOptionArgs.Count > 3)
            {
                Console.WriteLine("Expected 3 non-option arguments, you gave {0}", nonOptionArgs.Count);
                optionsParser.PrintUsage();
                return(-1);
            }

            String remoteHost    = nonOptionArgs[0];
            String minPortString = nonOptionArgs[1];
            String maxPortString = nonOptionArgs[2];

            UInt16 minPort = UInt16.Parse(minPortString);
            UInt16 maxPort = UInt16.Parse(maxPortString);

            TimeSpan timeout = optionsParser.timeoutMilliseconds.isSet ?
                               new TimeSpan(0, 0, 0, 0, (Int32)optionsParser.timeoutMilliseconds.ArgValue) :
                               TimeSpan.Zero;

            IPAddress remoteHostIP = GenericUtilities.ResolveHost(remoteHost);

            PortScanner portScanner = new PortScanner(remoteHostIP, minPort, maxPort,
                                                      optionsParser.maxThreadCount.ArgValue, timeout, optionsParser.sleepTimeMilliseconds.ArgValue);

            portScanner.Scan();

            return(0);
        }
Example #29
0
        public void CreateItem()
        {
            if (!m_loaded)
            {
                return;
            }

            var context = new GenericMenu();


            foreach (var type in GenericUtilities.FindAllDerivedTypes <ItemDefinition>())
            {
                var newItemTemplate = (ItemDefinition)Activator.CreateInstance(type);
                context.AddItem(new GUIContent(newItemTemplate.ReadableType()), false, () =>
                {
                    newItemTemplate.DisplayName =
                        $"new {newItemTemplate.ReadableType()}{(m_itemListEditor.ItemCount + 1)}";
                    m_itemListEditor.Add(newItemTemplate);
                });
            }

            context.ShowAsContext();
        }
Example #30
0
    private void FixedUpdate()
    {
        controller.height = HeightBuffer;
        controller.center = new Vector3(0, (HeightBuffer / 2) + .15f, 0);
        if (!isLocalPlayer)
        {
            return;
        }
        if (groundTracer.isGrounded)
        {
            if (velocity.y <= 0)
            {
                velocity.y = Clamp(velocity.y - 5 * Time.fixedDeltaTime, -10, 10);
            }
            isGrounded = true;
        }
        else
        {
            velocity.y += gravity * Time.fixedDeltaTime;
            isGrounded  = false;
        }
        if (anim != null)
        {
            //Planar Movement
            PlanarMovement = ((transform.position - LastLocation) / Time.deltaTime);
            var vecmag = PlanarMovement.magnitude / 10;
            var angle  = Atan2(PlanarMovement.x, PlanarMovement.z) - (transform.rotation.eulerAngles.y * Mathf.Deg2Rad);
            var movDir = new Vector2(Cos(angle), Sin(angle)) * (vecmag > .01 ? vecmag : 0);
            anim.MoveDirection = movDir;
            anim.MoveSpeed     = PlanarMovement.magnitude * (AnimationSpeedMultiplier / 10);
            anim.PlayerAlt     = GenericUtilities.ToPercent01(CrouchedHeight, UprightHeight, HeightBuffer);
            anim.Grounded      = isGrounded;

            LastLocation = transform.position;
        }
    }