get() public static method

public static get ( ) : Hero
return Hero
コード例 #1
0
ファイル: SuicideButton.cs プロジェクト: afaucher17/Hero.Coli
 private void OnPress(bool isPressed)
 {
     if (isPressed)
     {
         Hero.get().kill();
     }
 }
コード例 #2
0
    public void sendEvent(TrackingEvent trackingEvent, CustomData customData = null, string section = null, int[] coordinates = null, string userTime = null)
    {
        string checkedSection = section;

        //TODO remove dependency to Hero class
        if (string.IsNullOrEmpty(section) && (null != Hero.get()))
        {
            checkedSection = Hero.get().getLastCheckpointName();
        }

        int[] checkedCoordinates = null;
        if (null != coordinates)
        {
            checkedCoordinates = new int[coordinates.Length];
            for (int i = 0; i < coordinates.Length; i++)
            {
                checkedCoordinates [i] = coordinates [i];
            }
        }
        else
        {
            if (null != Hero.get())
            {
                Vector3 position = Hero.get().gameObject.transform.position;
                checkedCoordinates = new int[2] {
                    Mathf.FloorToInt(position.x),
                    Mathf.FloorToInt(position.z)
                };
            }
        }

        //logMessage(MessageLevel.DEFAULT, "RedMetricsManager::sendEvent({0})", trackingEvent.ToString());
        if (Application.isWebPlayer)
        {
            TrackingEventDataWithoutIDs data = new TrackingEventDataWithoutIDs(trackingEvent, customData, checkedSection, checkedCoordinates, userTime);
            if (isGameSessionGUIDCreated)
            {
                string json = getJsonString(data);
                Application.ExternalCall("rmPostEvent", json);
            }
            else
            {
                addEventToSendLater(data);
                //TODO: what if connection fails, or even fails permanently? Should retry connection at different intervals
            }
        }
        else
        {
            //TODO wait on gameSessionGUID using an IEnumerator
            if (defaultGameSessionGUID != gameSessionGUID)
            {
            }
            else
            {
                logMessage(MessageLevel.ERROR, "sendEvent default player guid: no registered player!");
            }

            TrackingEventDataWithIDs data = new TrackingEventDataWithIDs(gameSessionGUID, gameVersionGuid, trackingEvent, customData, checkedSection, checkedCoordinates);
            string json = getJsonString(data);
            //logMessage (MessageLevel.DEFAULT, string.Format ("RedMetricsManager::sendEvent - gameSessionGUID={0}, gameVersionGuid={1}, json={2}", gameSessionGUID, gameVersionGuid, json));
            sendDataStandalone(redMetricsEvent, json, value => wwwLogger(value, "sendEvent(" + trackingEvent + ")"));
            //TODO pass data as parameter to sendDataStandalone so that it's serialized inside
        }
    }
コード例 #3
0
ファイル: Hero.cs プロジェクト: afaucher17/Hero.Coli
 void Awake()
 {
     Logger.Log("Hero::Awake", Logger.Level.INFO);
     Hero.get();
     _lifeManager = new Life(_life, _lifeRegen);
 }