Exemple #1
0
    public void OnInteractionInput(CPlayerInteractor.EInputInteractionType _eInputInteractionEvent, GameObject _cPlayerActor, RaycastHit _cRaycastHit, bool _bDown)
	{
        CNetworkViewId cNetworkViewId = _cPlayerActor.GetComponent<CNetworkView>().ViewId;

		switch(_eInputInteractionEvent)
		{
		case CPlayerInteractor.EInputInteractionType.Primary:
			if(EventPrimary != null)
                EventPrimary(_cRaycastHit, cNetworkViewId, _bDown);
			break;
			
		case CPlayerInteractor.EInputInteractionType.Secondary:
			if(EventSecondary != null)
                EventSecondary(_cRaycastHit, cNetworkViewId, _bDown);
			break;
			
		case CPlayerInteractor.EInputInteractionType.Use:
			if (EventUse != null)
                EventUse(_cRaycastHit, cNetworkViewId, _bDown);
			break;
			
		default:
			break;
		}
	}
Exemple #2
0
    public static void UnserializeInbound(CNetworkPlayer _cNetworkPlayer, CNetworkStream _cStream)
    {
        if (CGamePlayers.SelfActor == null)
        {
            return;
        }

        CPlayerInteractor cPlayerInteractor = CGamePlayers.SelfActor.GetComponent <CPlayerInteractor>();

        while (_cStream.HasUnreadData)
        {
            ENetworkAction eAction          = (ENetworkAction)_cStream.ReadByte();
            CNetworkViewId cNewTargetViewId = _cStream.ReadNetworkViewId();

            switch (eAction)
            {
            case ENetworkAction.UpdateTarget:
                if (cNewTargetViewId != null)
                {
                    cPlayerInteractor.m_cTargetActorObject = cNewTargetViewId.GameObject;
                    if (cPlayerInteractor.EventServerTargetChange != null)
                    {
                        cPlayerInteractor.EventServerTargetChange(cPlayerInteractor.m_cTargetActorObject);
                    }

                    // Debug.LogError("Found new target: " + cPlayerInteractor.m_cTargetActorObject);
                }
                else
                {
                    cPlayerInteractor.m_cTargetActorObject = null;
                    if (cPlayerInteractor.EventServerTargetChange != null)
                    {
                        cPlayerInteractor.EventServerTargetChange(null);
                    }

                    //Debug.LogError("Found new target: " + null);
                }
                break;

            default:
                Debug.LogError("Unknown network action");
                break;
            }
        }
    }
Exemple #3
0
	public void OnCellInsertRequest(CPlayerInteractor.EInputInteractionType _eType, GameObject _cInteractableObject, RaycastHit _cRayHit)
	{
        /*
		if (_eType == CPlayerInteractor.EInteractionType.PrimaryStart &&
			_cInteractableObject.GetComponent<CCellSlot>() != null &&
			IsCarryingModule)
		{
			CPartInterface.EType carryingCellType = CNetwork.Factory.FindObject(CarryingModuleViewId).GetComponent<CPartInterface>().m_eType;
			CPartInterface.EType cellSlotType = _cInteractableObject.GetComponent<CCellSlot>().m_CellSlotType;
			
			if(carryingCellType == cellSlotType)
			{
				// Function to insert the cell here
				Debug.Log("Ima sliding my " + carryingCellType.ToString() + " into a " + cellSlotType.ToString() + " slot.");
				
				// Action
				s_cSerializeStream.Write((byte)ENetworkAction.InsertCell);

				// Target tool view id
				s_cSerializeStream.Write(_cInteractableObject.GetComponent<CNetworkView>().ViewId);
			}
		}
         * */
	}
Exemple #4
0
	public void OnPickupModuleRequest(CPlayerInteractor.EInputInteractionType _eType, GameObject _cInteractableObject, RaycastHit _cRayHit)
	{
        /*
		if (_eType == CPlayerInteractor.EInteractionType.UseStart &&
			_cInteractableObject.GetComponent<CPartInterface>() != null)
		{
			// Action
			s_cSerializeStream.Write((byte)ENetworkAction.PickupModule);

			// Target tool view id
			s_cSerializeStream.Write(_cInteractableObject.GetComponent<CNetworkView>().ViewId);
		}
         * */
	}
Exemple #5
0
 void OnEventInteractionUse(CPlayerInteractor.EInputInteractionType _eInteractionType, GameObject _cActorInteractable, RaycastHit _cRaycastHit, bool _bDown)
 {
     if (_bDown)
     {
         if (_cActorInteractable.GetComponent<CToolInterface>() != null)
         {
             s_cSerializeStream.Write((byte)ENetworkAction.PickupTool);
             s_cSerializeStream.Write(_cActorInteractable.GetComponent<CNetworkView>().ViewId);
         }
     }
 }
Exemple #6
0
	void OnUse(CPlayerInteractor.EInputInteractionType _eInteractionType, GameObject _cActorInteractable, RaycastHit _cRaycastHit, bool _bDown)
	{

	}