Beispiel #1
0
    public static void setBattleEventValue(IFirebase refFirebase, RemoteEventBase theEvent)
    {
        Dictionary <string, object> currentlocatoin = new Dictionary <string, object>();

        currentlocatoin.Add(RemoteEventBase.KEY_VECTOR_X, theEvent.getCurrentLocation().x);
        currentlocatoin.Add(RemoteEventBase.KEY_VECTOR_Y, theEvent.getCurrentLocation().y);
        currentlocatoin.Add(RemoteEventBase.KEY_VECTOR_Z, theEvent.getCurrentLocation().z);

        Dictionary <string, object> targetlocation = new Dictionary <string, object>();

        targetlocation.Add(RemoteEventBase.KEY_VECTOR_X, theEvent.getTargetLocation().x);
        targetlocation.Add(RemoteEventBase.KEY_VECTOR_Y, theEvent.getTargetLocation().y);
        targetlocation.Add(RemoteEventBase.KEY_VECTOR_Z, theEvent.getTargetLocation().z);

        Dictionary <string, object> value = new Dictionary <string, object>();

        value.Add(RemoteEventBase.KEY_ACTION_NAME, theEvent.getActionName());
        value.Add(RemoteEventBase.KEY_ACTOR, theEvent.getActorId());
        value.Add(RemoteEventBase.KEY_ACT_TARGET, theEvent.getActTarget());
        value.Add(RemoteEventBase.KEY_PLAYER_ID, theEvent.getPlayerId());

        value.Add(RemoteEventBase.KEY_LOC_CURRENT, currentlocatoin);
        value.Add(RemoteEventBase.KEY_LOC_TARGET, targetlocation);
        value.Add(RemoteEventBase.KEY_TIME_STAMP, theEvent.getTimeStamp());

        refFirebase.Child(RemoteEventBase.KEY_EVENT_ROOT).Push().SetValue(value);
    }
Beispiel #2
0
    protected virtual BaseUnit onCreateUnit(RemoteEventBase theEvent)
    {
        Logger.firebase("Humanoid onRemoteUpdate not find " + theEvent.getActorId());
        Logger.firebase("Humanoid onRemoteCreate +" + " " + theEvent.getActorId());
        BaseUnit temp = null;

        if (unitInstances.TryGetValue(theEvent.getActorId(), out temp))
        {
            Logger.firebase("Humanoid onRemoteCreate fail due to exist +" + " " + theEvent.getActorId());
            return(null);
        }
        GameObject obj = Instantiate(myUnits[0], convertLocationByHumanoid(theEvent.getCurrentLocation()), Quaternion.identity) as GameObject;

        obj.transform.parent = gameController.transform;
        BaseUnit unit = obj.GetComponent <BaseUnit>();

        unit.setGameController(gameController);
        unit.Myfaction      = getHumanoidFaction();
        unit.Id             = theEvent.getActorId();
        unit.playerIdOfUnit = theEvent.getPlayerId();
        unit.setHumanoidHolder(this);
        unitInstances.Add(unit.Id, unit);

        onMoveUnit(theEvent, unit);

        return(unit);
    }