Exemple #1
0
    void LateUpdate()
    {
        if (updateMoveToLog)
        {
            Vector3 currentPos = new Vector3(Mathf.Round(transform.position.x), Mathf.Round(transform.position.y), Mathf.Round(transform.position.z));

            // player moved to a new cell, log it
            PlayerActionsMovedToData tempObj = new PlayerActionsMovedToData
            {
                FromCell         = myPreviousCell,
                CurrentCell      = myCurrentCell,
                time             = gamePlayManager.GetCurrentTime(),
                CurrentActualPos = currentPos
            };
            if (gamePlayManager.LOG_ENABLED)
            {
                LogDB.instance.SetPlayerActionsMovedToData(tempObj);
            }
            updateMoveToLog = false;

            myPreviousCell = myCurrentCell; // set previous cell to current cell so we dont need to update the log with duplicates
        }
        if (updateLookToLog)
        {
            Vector3 localLookAtAngle = new Vector3(Mathf.Round(mainCamera.transform.eulerAngles.x), Mathf.Round(m_CharacterTargetRot.eulerAngles.y), Mathf.Round(m_CharacterTargetRot.eulerAngles.z));
            Vector3 currentPos       = new Vector3(Mathf.Round(transform.position.x), Mathf.Round(transform.position.y), Mathf.Round(transform.position.z));

            // player moved to a new cell, log it
            PlayerActionsLookingAtData tempObj = new PlayerActionsLookingAtData
            {
                target           = (currentLookAtTarget != null) ? currentLookAtTarget.name : "",
                CurrentCell      = myCurrentCell,
                time             = gamePlayManager.GetCurrentTime(),
                CurrentActualPos = currentPos,
                CurrentActualLookingDirection = localLookAtAngle
            };
            if (gamePlayManager.LOG_ENABLED)
            {
                LogDB.instance.SetPlayerActionsLookingAtData(tempObj);
            }
            updateLookToLog = false;
        }
    }
Exemple #2
0
 public bool SetPlayerActionsMovedToData(PlayerActionsMovedToData pamtdata)
 {
     if (currentSecnarioMasterKey != "")
     {
         if (pamtdata != null)
         {
             JSON tempobj = JSON.Serialize(pamtdata);
             LogData.GetJSON(currentSecnarioMasterKey).GetJSON("PlayerActions").GetJArray("MovedTo").Add(tempobj);
             //currentPlayerMovedToData.Add(tempobj);
             logDataUpdated = true;
             return(true);
         }
         else
         {
             Debug.LogAssertion("Data for New attepmt to save Player Actions Moved To is empty or null or not set properly, please recheck");
             return(false);
         }
     }
     Debug.LogAssertion("Please use SetScenarioMasterLogObject with appropriate key to start logging this into the correct scenario");
     return(false);
 }