private void UpdateUse(float dt) { if (selectedObject != null) { //Debug.Log("Have Selected Object"); if (Input.GetKeyDown(KeyCode.E)) { //Debug.Log("UseBegin"); UseBegin u = new UseBegin(); u.user = gameObject; FFMessageBoard <UseBegin> .Send(u, selectedObject); } else if (Input.GetKey(KeyCode.E)) { //Debug.Log("Using"); Using u = new Using(); u.user = gameObject; u.dt = dt; FFMessageBoard <Using> .Send(u, selectedObject); if (u.valid) { UpdatePlayerMessage(u.pm, 1.0f - (u.timeRemaining / u.timeToCompelte)); } } } else { //Debug.Log("Don't Have selected Object"); } }
public override void SendToLocalGameObject(FFBasePacket package, GameObject go) { FFPacket <EventType> sentPackage = (FFPacket <EventType>)package; FFPacket <EventType> .Decrypt(ref sentPackage.message); switch (package.packetInstructions) { case FFPacketInstructionFlags.MessageBoardGameObjectSend: FFMessageBoard <EventType> .SendToLocal(sentPackage.message, go); break; case FFPacketInstructionFlags.MessageBoardGameObjectSendDown: FFMessageBoard <EventType> .SendToLocalDown(sentPackage.message, go); break; case FFPacketInstructionFlags.MessageBoardGameObjectSendUp: FFMessageBoard <EventType> .SendToLocalUp(sentPackage.message, go); break; case FFPacketInstructionFlags.MessageBoardGameObjectSendToAllConnected: FFMessageBoard <EventType> .SendToLocalToAllConnected(sentPackage.message, go); break; default: break; } }
void DestroyOnRope() { if (OnRope.rope != null) { FFMessageBoard <RopeChange> .Disconnect(OnRopeChange, OnRope.rope.gameObject); } }
// Use this for initialization void Start() { cursorDelaySeq = action.Sequence(); FFMessageBoard <UnBlockUseArea> .Connect(OnUnBlockUseArea, gameObject); FFMessageBoard <BlockUseArea> .Connect(OnBlockUseArea, gameObject); }
// Update is called once per frame void Update() { float lightLevel = FindObjectOfType <GlobalLightChecker>().GetTotalLightLevel(transform); if ((!mCrying && lightLevel >= 1.5f) || (!mCrying && mGoCryHackSwitch)) { mCrying = true; mMyActionList.ClearSequence(); GetComponent <ExPathFollower>().enabled = false; StartCoroutine("GoCry"); var text = "ScareAway"; var box = FFMessageBoard <CustomDialogOn> .Box((string)text); CustomDialogOn cdo; cdo.tag = (string)text; box.SendToLocal(cdo); } else if ((mCrying && GameMath.DistanceBetween(this, mCryingPlace) <= 3.0f && lightLevel >= 2.5f) || mBeCuredHackSwitch) { var text = "Rescue"; var box = FFMessageBoard <CustomDialogOn> .Box((string)text); CustomDialogOn cdo; cdo.tag = (string)text; box.SendToLocal(cdo); // Become human? Destroy(this); } }
private void OnDestroy() { FFMessageBoard <UseBegin> .Disconnect(OnUseBegin, gameObject); FFMessageBoard <Using> .Disconnect(OnUsing, gameObject); FFMessageBoard <QueryUsable> .Disconnect(OnQueryUsable, gameObject); }
void SendUpdateEvent(float dt) { RopeChange rc; rc.controller = this; rc.dt = dt; FFMessageBoard <RopeChange> .SendToLocal(rc, gameObject); }
void SendLookAt(GameObject go) { //Debug.Log("PlayerInteract.SendLookAt"); LookingAt lookAt = new LookingAt(); lookAt.actor = interactorCamera.transform; FFMessageBoard <LookingAt> .SendToLocalToAllConnected(lookAt, go); }
void SendLooking(GameObject go) { //Debug.Log("PlayerInteract.SendLooking"); Looking looking = new Looking(); looking.actor = interactorCamera.transform; FFMessageBoard <Looking> .SendToLocalToAllConnected(looking, go); }
void SendUse(GameObject go) { //Debug.Log("PlayerInteract.SendUse"); Use u = new Use(); u.actor = transform; FFMessageBoard <Use> .SendToLocalToAllConnected(u, go); }
// Use this for initialization void Start() { FFMessageBoard <GiveCoins> .Connect(OnGiveCoin, gameObject); FFMessageBoard <GiveObject> .Connect(OnGiveObject, gameObject); UpdateUI(); }
private void GrantCoins(PlayerInteract.Use e) { // Send out event to player GiveCoins gc; gc.coinCount = coinCount + Random.Range(-coinCountVarience, coinCountVarience); FFMessageBoard <GiveCoins> .SendToLocalToAllConnected(gc, e.actor.gameObject); }
// private Initialization function private static void GetReady() { if (messageBoardSystem == null) { messageBoardSystem = new FFMessageBoard <EventType>(); FFPrivate.FFMessageSystem.AddMessageBoard(messageBoardSystem, typeof(EventType).ToString()); } }
// Use this for initialization void Start() { FFMessageBoard <UseBegin> .Connect(OnUseBegin, gameObject); FFMessageBoard <Using> .Connect(OnUsing, gameObject); FFMessageBoard <QueryUsable> .Connect(OnQueryUsable, gameObject); }
public override bool SendToLocalEntry(FFBasePacket package, string entry) { FFPacket <EventType> sentPackage = (FFPacket <EventType>)package; FFPacket <EventType> .Decrypt(ref sentPackage.message); return(FFMessageBoard <EventType> .SendToLocal(sentPackage.message, entry)); }
void SetupOnRope() { SetVelocityRef(new FFRef <Vector3>( () => OnRope.rope.VelocityAtDistUpRope(OnRope.distUpRope), (v) => {})); FFMessageBoard <RopeChange> .Connect(OnRopeChange, OnRope.rope.gameObject); }
void SendLookAway(GameObject go) { //Debug.Log("PlayerInteract.SendLookAway"); LookingAway lookAway = new LookingAway(); lookAway.actor = interactorCamera.transform; FFMessageBoard <LookingAway> .SendToLocalToAllConnected(lookAway, go); }
private void GrantObject(PlayerInteract.Use e) { // Send out event to player GiveObject giveObject; giveObject.ObjectName = ObjectName; giveObject.objectCount = objectCount + Random.Range(-objectCountVarience, objectCountVarience); FFMessageBoard <GiveObject> .SendToLocalToAllConnected(giveObject, e.actor.gameObject); }
void SendCustomDialogEvent(object text) { var box = FFMessageBoard <CustomDialogOn> .Box((string)text); CustomDialogOn cdo; cdo.tag = (string)text; box.SendToLocal(cdo); }
void TriggerHealthEmpty() { EmptyHealthEvent e; e.currentHealth = currentHealth; FFMessageBoard <EmptyHealthEvent> .SendToLocal(e, gameObject); FFMessageBoard <EmptyHealthEvent> .SendToNet(e, gameObject, true); }
void UseSelectedObject() { if (selectedObject != null) { UseBegin u = new UseBegin(); u.user = gameObject; FFMessageBoard <UseBegin> .Send(u, selectedObject); } }
void OnDestroy() { FFMessageBoard <ApplyHealthEvent> .Disconnect(OnApplyHealth, gameObject); FFMessageBoard <EmptyHealthEvent> .Disconnect(OnHealthEmpty, gameObject); FFMessageBoard <ExHealth> .Disconnect(OnServerUpdate, gameObject); FFMessage <FFNetEvents.ClientConnectedEvent> .Disconnect(OnClientConnected); }
void OnDestroy() { // Events FFMessageBoard <ExPlayerMoveAction> .Disconnect(OnPlayerMoveAction, gameObject); FFMessageBoard <ExPlayerFireAction> .Disconnect(OnPlayerFireAction, gameObject); FFMessageBoard <ExPlayerPositionUpdate> .Disconnect(OnPlayerPositionUpdate, gameObject); FFMessage <FFLocalEvents.UpdateEvent> .Disconnect(OnUpdateEvent); }
private void UpdatePositionCall() { ExPlayerPositionUpdate e; e.position = transform.position; e.time = FFSystem.time; FFMessageBoard <ExPlayerPositionUpdate> .SendToNet(e, gameObject, false); PositionUpdateSeq.Delay(0.6f); PositionUpdateSeq.Sync(); PositionUpdateSeq.Call(UpdatePositionCall); }
private void OnDestroy() { FFMessageBoard <ConfigurePopup> .Disconnect(OnConfiurePopup, gameObject); FFMessageBoard <PlayerInteract.LookingAt> .Disconnect(OnLookAt, gameObject); FFMessageBoard <PlayerInteract.LookingAway> .Disconnect(OnLookAway, gameObject); FFMessageBoard <PlayerInteract.Looking> .Disconnect(OnLooking, gameObject); FFMessageBoard <PlayerInteract.Use> .Disconnect(OnUse, gameObject); }
// Use this for initialization void Start() { FFMessageBoard <ConfigurePopup> .Connect(OnConfiurePopup, gameObject); FFMessageBoard <PlayerInteract.LookingAt> .Connect(OnLookAt, gameObject); FFMessageBoard <PlayerInteract.LookingAway> .Connect(OnLookAway, gameObject); FFMessageBoard <PlayerInteract.Looking> .Connect(OnLooking, gameObject); FFMessageBoard <PlayerInteract.Use> .Connect(OnUse, gameObject); }
/// <summary> /// returns true if it could be sent to the net, if this box wasn't /// created via a FFMessageBoard it will not be able to send to Net /// </summary> public bool SendToNet(EventType e, bool varifiedPacket = false) { if (active && messageBoard != null) { messageBoard.IncrementCallCount(); ++callCountLocal; FFMessageBoard <EventType> .SendToNet(e, entry, varifiedPacket); return(true); } Debug.LogError("Warning, an FFMessageBox which is not connected to a FFMessageBoard tried to SendToNet."); return(false); }
void AddDialog(CharacterDialog.Dialog dialog) { gameDialog.Add(dialog); foreach (var cond in dialog.condition) { if (cond.type == CharacterDialog.Dialog.Condition.Type.Custom) { FFMessageBoard <CustomDialogOn> .Box(cond.identifier).Connect(OnCustomDialogOn); FFMessageBoard <CustomDialogOff> .Box(cond.identifier).Connect(OnCustomDialogOff); } } }
// Update is called once per frame void OnUpdateEvent(FFLocalEvents.UpdateEvent e) { FFVector3 moveDirection; moveDirection.x = Input.GetAxis("Horizontal"); moveDirection.y = Input.GetAxis("Vertical"); moveDirection.z = 0; if (Vector3.Magnitude(moveDirection) >= 1) { moveDirection = Vector3.Normalize(moveDirection); } // optimization: Don't send if its not different from the last // move packet sent if (_moveVec != moveDirection) { ExPlayerMoveAction moveEvent; moveEvent.moveDirection = moveDirection; moveEvent.time = FFSystem.time; moveEvent.position = gameObject.transform.position; FFMessageBoard <ExPlayerMoveAction> .SendToLocal(moveEvent, gameObject); FFMessageBoard <ExPlayerMoveAction> .SendToNet(moveEvent, gameObject, false); _moveVec = moveDirection; //Debug.Log("Moving!"); // debug } if (Input.GetButtonDown("Fire1")) { ExPlayerFireAction ePFA; ePFA.position = transform.position + FiringLocation; ePFA.time = FFSystem.time; FFMessageBoard <ExPlayerFireAction> .SendToLocal(ePFA, gameObject); FFMessageBoard <ExPlayerFireAction> .SendToNet(ePFA, gameObject, true); //Debug.Log("Fire1"); //debug } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("OnTrigger Entered 2d"); QueryUsable qu = new QueryUsable(); FFMessageBoard <QueryUsable> .Send(qu, collision.gameObject); if (qu.usableObject) { SelectUsableObject(qu); DisplayUsableObjectMessage(qu); } else { DeselectUsableObject(qu.gameObject); } }