Ejemplo n.º 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;
        }
    }
Ejemplo n.º 2
0
 public bool SetPlayerActionsLookingAtData(PlayerActionsLookingAtData padata)
 {
     if (currentSecnarioMasterKey != "")
     {
         if (padata != null)
         {
             JSON tempobj = JSON.Serialize(padata);
             LogData.GetJSON(currentSecnarioMasterKey).GetJSON("PlayerActions").GetJArray("LookingAt").Add(tempobj);
             //currentPlayerLookingAtData.Add(tempobj);
             logDataUpdated = true;
             return(true);
         }
         else
         {
             Debug.LogAssertion("Data for New attepmt to save Player Actions Looking at 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);
 }