Пример #1
0
	private void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
	{
		if(_cSyncedNetworkVar == m_Value)
		{
			m_IsDirty = true;
		}
	}
Пример #2
0
	public void OnNetworkVarSync(INetworkVar _rSender)
    {
		m_CreateExpansionStage = (EExpansionCreatePhase)m_ServerCreateExpansionStage.Get();
		m_LocalExpansionPortIdSelected = m_ServerLocalExpansionPortIdSelected.Get();
		m_OtherExpansionPortIdSelected = m_ServerOtherExpansionPortIdSelected.Get();
		m_FacilitySelected = (CFacilityInterface.EType)m_ServerFacilitySelected.Get();
    }
Пример #3
0
	private void OnNetworkVarSync(INetworkVar _SyncedNetworkVar)
	{
		if(_SyncedNetworkVar == m_ActivePanelId)
		{
			UpdatePanels();
		}
	}
Пример #4
0
	private void OnNetworkVarSync(INetworkVar _SyncedNetworkVar)
	{
		if(_SyncedNetworkVar == m_CurrentToolType)
		{
			UpdateToolPresentation();
		}
	}
Пример #5
0
	public void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
	{
		if (_cSyncedNetworkVar == m_tPosition)
		{
			InsertNewPosition();
		}
	}
Пример #6
0
	private void OnNetworkVarSync(INetworkVar _SyncedNetworkVar)
	{
		if(_SyncedNetworkVar == m_CurrentFacilityType)
		{
			UpdateChildFacilityPresentation();
		}
	}
Пример #7
0
	private void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		if(_VarInstance == m_AtmosphereGenerationRate)
		{
			if(EventGenerationRateChanged != null)
				EventGenerationRateChanged(this);
		}
	}
Пример #8
0
    public void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
    {
		// Head Rotation
		if (CGamePlayers.SelfActor != gameObject && 
			_cSyncedNetworkVar == m_fHeadEulerX)
	    {	
	        m_cActorHead.transform.localEulerAngles = new Vector3(m_fHeadEulerX.Get(), 0.0f, 0.0f);
	    }
    }
Пример #9
0
	void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		if(_VarInstance == m_BatteryCapacity)
		{
			if(EventBatteryCapacityChanged != null)
				EventBatteryCapacityChanged(this);
		}
		else if(_VarInstance == m_BatteryCharge)
		{
			if(EventBatteryChargeChanged != null)
				EventBatteryChargeChanged(this);
		}
	}
Пример #10
0
	void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		if(m_fPropulsionOutput == _VarInstance)
		{
			if(EventPropulsionOutputChanged != null)
				EventPropulsionOutputChanged(this);
		}
		else if(m_PropulsionPotential == _VarInstance)
		{
			if(EventPropulsionPotentialChanged != null)
				EventPropulsionPotentialChanged(this);
		}
	}
Пример #11
0
	void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		if(m_PowerGenerationRate == _VarInstance)
		{
			if(EventGenerationRateChanged != null)
				EventGenerationRateChanged(this);
		}
		else if(m_PowerGenerationRatePotential == _VarInstance)
		{
			if(EventGenerationRatePotentialChanged != null)
				EventGenerationRatePotentialChanged(this);
		}
	}
Пример #12
0
 public void OnNetworkVarSync(INetworkVar sender)
 {
     if (!CNetwork.IsServer)
     {
         if (Position && (sender == mPositionX || sender == mPositionY || sender == mPositionZ))
             transform.position = new Vector3(mPositionX.Get(), mPositionY.Get(), mPositionZ.Get());
         else if (Angle && (sender == mAngleX || sender == mAngleY || sender == mAngleZ))
             transform.eulerAngles = new Vector3(mAngleX.Get(), mAngleY.Get(), mAngleZ.Get());
         else if (PositionalVelocity && (sender == mPositionalVelocityX || sender == mPositionalVelocityY || sender == mPositionalVelocityZ))
             rigidbody.velocity = new Vector3(mPositionalVelocityX.Get(), mPositionalVelocityY.Get(), mPositionalVelocityZ.Get());
         else if (AngularVelocity && (sender == mAngularVelocityX || sender == mAngularVelocityY || sender == mAngularVelocityZ))
             rigidbody.angularVelocity = new Vector3(mAngularVelocityX.Get(), mAngularVelocityY.Get(), mAngularVelocityZ.Get());
     }
 }
Пример #13
0
	public void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
		if (_cSyncedVar == m_DUIActive)
		{
			if (IsDUIActive)
			{
				ActivateDUI();
			}
			else
			{
				DeactivateDUI();
			}
		}
	}
Пример #14
0
	void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
		if (_cSyncedVar == m_cParentViewId)
		{
			if (m_cParentViewId.Get() == null)
			{
				transform.parent = null;
			}
			else
			{
				transform.parent = m_cParentViewId.Get().GameObject.transform;
			}
		}
	}
Пример #15
0
    public void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_bOpened)
        {
            if (IsOpened)
            {
                if (EventOpened != null)
                {
                    EventOpened(gameObject);
                }
            }
            else
            {
                if (EventClosed != null)
                {
                    EventClosed(gameObject);
                }
            }

            m_fFrontPlateRotateTimer = 0.0f;
        }
        else if (_cSyncedVar == m_bWiresBroken)
        {
            if (IsBroken)
            {
                if (EventBroken != null)
                {
                    EventBroken(gameObject);
                }
            }
            else
            {
                if (EventFixed != null)
                {
                    EventFixed(gameObject);
                }
            }
        }


        if (IsBroken &&
            IsOpened)
        {
            transform.GetComponentInChildren <ParticleSystem>().Play();
        }
        else
        {
            transform.GetComponentInChildren <ParticleSystem>().Stop();
        }
    }
Пример #16
0
    void OnNetworkVarSync(INetworkVar _cVarInstance)
    {
        // If the updated network var was the health state
        if (_cVarInstance == m_HealthState)
        {
            // Switch on the current health state
            switch (CurrentHealthState)
            {
            // Alive
            case HealthState.ALIVE:
            {
                // Enable input
                transform.GetComponent <CPlayerGroundMotor>().ReenableInput(this);
                transform.GetComponent <CPlayerHead>().ReenableInput(this);

                // Break switch
                break;
            }

            // Dead
            case HealthState.DEAD:
            {
                // Break switch
                break;
            }

            // Downed
            case HealthState.DOWNED:
            {
                // Disable input
                transform.GetComponent <CPlayerGroundMotor>().DisableInput(this);
                transform.GetComponent <CPlayerHead>().DisableInput(this);

                // Break switch
                break;
            }

            // Default
            default:
            {
                // Log the current health state as an error
                Debug.LogError("Health state: " + CurrentHealthState.ToString());

                // Break switch
                break;
            }
            }
        }
    }
Пример #17
0
    public void SyncNetworkVarsWithPlayer(ulong _ulPlayerId)
    {
        // Send all current network variable values to player
        foreach (KeyValuePair<byte, INetworkVar> tEntry in m_mNetworkVars)
        {
            INetworkVar cNetworkVar = tEntry.Value;

			if (!cNetworkVar.IsDefault())
			{
				SyncNetworkVar(_ulPlayerId, tEntry.Key);
			}
        }

        Logger.Write("Sent player id ({0}) all network var values from network view id ({1})", _ulPlayerId, this.ViewId);
    }
Пример #18
0
 public void OnNetworkVarSync(INetworkVar _cSyncedVar)
 {
     if(_cSyncedVar == m_bRepairState)
     {
         if( (m_bRepairState.Get() & (uint)ERepairState.RepairActive) > 0)
         {
             m_eRepairState = ERepairState.RepairActive;
         }
         
         if( (m_bRepairState.Get() & (uint)ERepairState.RepairInactive) > 0)
         {
             m_eRepairState = ERepairState.RepairInactive;
         }
     }
 }
Пример #19
0
    public void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_bRepairState)
        {
            if ((m_bRepairState.Get() & (uint)ERepairState.RepairActive) > 0)
            {
                m_eRepairState = ERepairState.RepairActive;
            }

            if ((m_bRepairState.Get() & (uint)ERepairState.RepairInactive) > 0)
            {
                m_eRepairState = ERepairState.RepairInactive;
            }
        }
    }
Пример #20
0
	void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		if(_VarInstance == m_PowerActive)
		{
			if(IsPowerActive)
			{
				if(EventFacilityPowerActivated != null) 
					EventFacilityPowerActivated(gameObject);
			}
			else
			{
				if(EventFacilityPowerDeactivated != null) 
					EventFacilityPowerDeactivated(gameObject);
			}
		}
	}
Пример #21
0
 void OnNetworkVarSync(INetworkVar _cSyncedVar)
 {
     m_bActive.Set(false);
     gameObject.GetComponent <CAudioCue>().StopAllSound();
     if (_cSyncedVar == m_bActive)
     {
         if (m_bActive.Get())
         {
             m_cSprayParticalSystem.Play();
         }
         else
         {
             m_cSprayParticalSystem.Stop();
         }
     }
 }
Пример #22
0
 void OnNetworkVarSync(INetworkVar _VarInstance)
 {
     if (_VarInstance == m_BatteryCapacity)
     {
         if (EventBatteryCapacityChanged != null)
         {
             EventBatteryCapacityChanged(this);
         }
     }
     else if (_VarInstance == m_BatteryCharge)
     {
         if (EventBatteryChargeChanged != null)
         {
             EventBatteryChargeChanged(this);
         }
     }
 }
Пример #23
0
 void OnNetworkVarSync(INetworkVar _VarInstance)
 {
     if (_VarInstance == m_iStoredNanites)
     {
         if (EventNaniteStorageChanged != null)
         {
             EventNaniteStorageChanged(this);
         }
     }
     else if (_VarInstance == m_iNaniteCapacity)
     {
         if (EventNaniteCapacityChanged != null)
         {
             EventNaniteCapacityChanged(this);
         }
     }
 }
Пример #24
0
    public void OnNetworkVarSync(INetworkVar _rSender)
    {
        if (!CNetwork.IsServer)
        {
            // Position
            if (_rSender == m_Position)
            {
                transform.position = m_Position.Get();
            }

            // Rotation
            else if (_rSender == m_EulerAngles)
            {
                transform.eulerAngles = m_EulerAngles.Get();
            }
        }
    }
Пример #25
0
	public void OnNetworkVarSync(INetworkVar _rSender)
    {
		// Door State
		if(_rSender == m_DoorState)
		{
			if(DoorState == EDoorState.Opened)
			{
				if(EventDoorStateOpened != null)
					EventDoorStateOpened(gameObject);			
			}
			else if(DoorState == EDoorState.Closed)
			{
				if(EventDoorStateClosed != null)
					EventDoorStateClosed(gameObject);
			}
		}
    }
Пример #26
0
	public void OnNetworkVarSync(INetworkVar _rSender)
	{
		if(!CNetwork.IsServer)
		{
			// Position
			if (_rSender == m_Position)
			{
				transform.position = m_Position.Get();
			}
			
			// Rotation
			else if (_rSender == m_EulerAngles)
			{	
				transform.eulerAngles = m_EulerAngles.Get();
			}
		}
	}
Пример #27
0
 void OnNetworkVarSync(INetworkVar _VarInstance)
 {
     if (m_PowerGenerationRate == _VarInstance)
     {
         if (EventGenerationRateChanged != null)
         {
             EventGenerationRateChanged(this);
         }
     }
     else if (m_PowerGenerationRatePotential == _VarInstance)
     {
         if (EventGenerationRatePotentialChanged != null)
         {
             EventGenerationRatePotentialChanged(this);
         }
     }
 }
Пример #28
0
 void OnNetworkVarSync(INetworkVar _VarInstance)
 {
     if (m_fPropulsionOutput == _VarInstance)
     {
         if (EventPropulsionOutputChanged != null)
         {
             EventPropulsionOutputChanged(this);
         }
     }
     else if (m_PropulsionPotential == _VarInstance)
     {
         if (EventPropulsionPotentialChanged != null)
         {
             EventPropulsionPotentialChanged(this);
         }
     }
 }
Пример #29
0
	public void OnNetworkVarSync(INetworkVar _rSender)
	{
		// Boarding state
		if(_rSender == m_BoardingState)
		{
			if(BoardingState == EBoardingState.Onboard && m_CanBoard)
			{
				if(EventBoard != null)
					EventBoard();
			}
			else if(BoardingState == EBoardingState.Offboard && m_CanDisembark)
			{
				if(EventDisembark != null)
					EventDisembark();
			}
		}
	}
Пример #30
0
    void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_cTargetAsteroidViewId)
        {
            // Un-highlight previous
            if (m_cTargetAsteroidViewId.GetPrevious() != null &&
                m_cTargetAsteroidViewId.GetPrevious().GameObject != null)
            {
                m_cTargetAsteroidViewId.GetPrevious().GameObject.GetComponent <CAsteroidChunkBehaviour>().SetHighlighted(false);
            }

            // Highlight new target
            if (m_cTargetAsteroidViewId.Get() != null)
            {
                m_cTargetAsteroidViewId.Get().GameObject.GetComponent <CAsteroidChunkBehaviour>().SetHighlighted(true);
            }
        }
        else if (_cSyncedVar == m_bFractureLaserVisible)
        {
            if (m_bFractureLaserVisible.Get())
            {
                // Show laser
                m_cFractureLaserObject.SetActive(true);
            }
            else
            {
                // Hide laser
                m_cFractureLaserObject.SetActive(false);
            }
        }
        else if (_cSyncedVar == m_bExtractorBeamVisible)
        {
            if (m_bExtractorBeamVisible.Get())
            {
                // Show laser
                m_cExtractorBeamObject.SetActive(true);
            }
            else
            {
                // Hide laser
                m_cExtractorBeamObject.SetActive(false);
            }
        }
    }
Пример #31
0
    public void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
    {
        if (_cSyncedNetworkVar == m_cOwnerActorViewId)
        {
            if (IsHeld)
            {
                GameObject cOwnerPlayerActor = OwnerPlayerActor;

                gameObject.transform.parent        = cOwnerPlayerActor.transform;
                gameObject.transform.localPosition = new Vector3(-0.5f, 0.36f, 0.5f);
                gameObject.transform.localRotation = Quaternion.identity;

                // Turn off dynamic physics
                if (CNetwork.IsServer)
                {
                    rigidbody.isKinematic      = true;
                    rigidbody.detectCollisions = false;
                }

                // Stop receiving synchronizations
                GetComponent <CActorNetworkSyncronized>().m_SyncPosition = false;
                GetComponent <CActorNetworkSyncronized>().m_SyncRotation = false;
            }
            else
            {
                gameObject.transform.parent = null;

                // Turn on dynamic physics
                if (CNetwork.IsServer)
                {
                    rigidbody.isKinematic      = false;
                    rigidbody.detectCollisions = true;
                }

                rigidbody.AddForce(transform.forward * 5.0f, ForceMode.VelocityChange);
                rigidbody.AddForce(Vector3.up * 5.0f, ForceMode.VelocityChange);

                // Receive synchronizations
                GetComponent <CActorNetworkSyncronized>().m_SyncPosition = true;
                GetComponent <CActorNetworkSyncronized>().m_SyncRotation = true;
            }
        }
    }
Пример #32
0
    void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
    {
        if (_cSyncedNetworkVar == m_cFacilityViewId)
        {
            // Not in any facility anymore
            if (m_cFacilityViewId.Get() == null)
            {
                // Notify leave facility observers
                if (EventEnterFacility != null)
                {
                    EventLeaveFacility(CNetwork.Factory.FindObject(m_cFacilityViewId.GetPrevious()));
                }

                // Was in a facility before
                if (m_cFacilityViewId.GetPrevious() != null)
                {
                    // Notify leave ship observers
                    if (EventLeaveShip != null)
                    {
                        EventLeaveShip();
                    }
                }
            }
            else
            {
                // Notify enter facility observers
                if (EventEnterFacility != null)
                {
                    EventEnterFacility(CNetwork.Factory.FindObject(m_cFacilityViewId.Get()));
                }

                // Was not in a facility before
                if (m_cFacilityViewId.GetPrevious() == null)
                {
                    // Notify enter ship observers
                    if (EventEnterShip != null)
                    {
                        EventEnterShip();
                    }
                }
            }
        }
    }
Пример #33
0
	public void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
	{
		if (_cSyncedNetworkVar == m_cOwnerActorViewId)
		{
			if (IsHeld)
			{
				GameObject cOwnerPlayerActor = OwnerPlayerActor;
				
				gameObject.transform.parent = cOwnerPlayerActor.transform;
				gameObject.transform.localPosition = new Vector3(-0.5f, 0.36f, 0.5f);
				gameObject.transform.localRotation = Quaternion.identity;
				
				// Turn off dynamic physics
				if(CNetwork.IsServer)
				{
					rigidbody.isKinematic = true;
					rigidbody.detectCollisions = false;
				}
				
				// Stop receiving synchronizations
				GetComponent<CActorNetworkSyncronized>().m_SyncPosition = false;
				GetComponent<CActorNetworkSyncronized>().m_SyncRotation = false;
			}
			else
			{
				gameObject.transform.parent = null;
				
				// Turn on dynamic physics
				if(CNetwork.IsServer)
				{
					rigidbody.isKinematic = false;
					rigidbody.detectCollisions = true;
				}
				
				rigidbody.AddForce(transform.forward * 5.0f, ForceMode.VelocityChange);
				rigidbody.AddForce(Vector3.up * 5.0f, ForceMode.VelocityChange);
				
				// Receive synchronizations
				GetComponent<CActorNetworkSyncronized>().m_SyncPosition = true;
				GetComponent<CActorNetworkSyncronized>().m_SyncRotation = true;
			}
		}
	}
Пример #34
0
	public void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
		if (_cSyncedVar == m_bOpened)
		{
			if (IsOpened)
			{
				if(EventOpened != null)
					EventOpened(gameObject);
			}
			else
			{
				if(EventClosed != null)
					EventClosed(gameObject);
			}

			m_fFrontPlateRotateTimer = 0.0f;
		}
		else if (_cSyncedVar == m_bWiresBroken)
		{
			if (IsBroken)
			{
				if(EventBroken != null)
					EventBroken(gameObject);
			}
			else
			{
				if(EventFixed != null)
					EventFixed(gameObject);
			}
		}


		if (IsBroken &&
			IsOpened)
		{
			transform.GetComponentInChildren<ParticleSystem>().Play();
		}
		else
		{
			transform.GetComponentInChildren<ParticleSystem>().Stop();
		}
	}
Пример #35
0
    void OnNetworkVarSync(INetworkVar _SyncedVar)
    {
        if (_SyncedVar == m_IsActive)
        {
            if (m_IsActive.Get())
            {
                if (CGamePlayers.SelfActor == gameObject)
                {
                    // Placeholder: Disable movement input
                    GetComponent <CPlayerHead>().DisableInput(this);
                    GetComponent <CPlayerGroundMotor>().DisableInput(this);
                }

                // Debug fix: make the head body realign instantly
                Quaternion headRot = GetComponent <CPlayerHead>().ActorHead.transform.rotation;
                transform.rotation = headRot;
                GetComponent <CPlayerHead>().ActorHead.transform.rotation = headRot;

//				// Start realigning the head
//				m_RealignBodyWithHead = true;
//
//				// Set the values to use for realigment
//				Transform actorHead = GetComponent<CPlayerHead>().ActorHead.transform;
//				m_RealignFromRotation = transform.rotation;
//				m_RealignToRotation = actorHead.rotation;
//				m_RealignHeadTimer = 0.0f;
//				m_RealignHeadTime = 0.0f;
            }
            else
            {
                if (CGamePlayers.SelfActor == gameObject)
                {
                    // Placeholder: Enable movement input
                    GetComponent <CPlayerHead>().ReenableInput(this);
                    GetComponent <CPlayerGroundMotor>().ReenableInput(this);
                }

                // Stop any head realignment with body
                m_RealignBodyWithHead = false;
            }
        }
    }
Пример #36
0
 void OnNetworkVarSync(INetworkVar _cVarInstance)
 {
     if (_cVarInstance == m_bBreached)
     {
         if (m_bBreached.Get())
         {
             if (EventBreached != null)
             {
                 EventBreached();
             }
         }
         else
         {
             if (EventBreachFixed != null)
             {
                 EventBreachFixed();
             }
         }
     }
 }
Пример #37
0
	void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
	{
		if(_cSyncedNetworkVar == m_bIsFunctional)
		{
			if(IsFunctional)
			{
				if(EventComponentFix != null)
				{
					EventComponentFix(this);
				}	
			}
			else
			{
				if(EventComponentBreak != null)
				{
					EventComponentBreak(this);
				}
			}
		}
	}
Пример #38
0
 void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
 { 
     if (_cSyncedNetworkVar == m_bRagdollState)
     {
         switch((ENetworkAction) m_bRagdollState.Get())
         {
             case ENetworkAction.EventDeath:
             {
                 SetRagdollActive();                    
                 break;                
             }
             
             case ENetworkAction.EventRevive:
             {
                 DeactivateRagdoll();                
                 break;                
             }
         }
     }
 } 
Пример #39
0
    void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
    {
        if (_cSyncedNetworkVar == m_bRagdollState)
        {
            switch ((ENetworkAction)m_bRagdollState.Get())
            {
            case ENetworkAction.EventDeath:
            {
                SetRagdollActive();
                break;
            }

            case ENetworkAction.EventRevive:
            {
                DeactivateRagdoll();
                break;
            }
            }
        }
    }
Пример #40
0
 void OnNetworkVarSync(INetworkVar _cSyncedVar)
 {
     if (_cSyncedVar == m_bStates)
     {
         // Notify event observers
         if (EventStatesChange != null)
         {
             EventStatesChange(PreviousStates, States);
         }
     }
     else if (_cSyncedVar == m_fRotationY)
     {
         if (gameObject != CGamePlayers.SelfActor)
         {
             transform.eulerAngles = new Vector3(0.0f,
                                                 m_fRotationY.Get(),
                                                 0.0f);
         }
     }
 }
Пример #41
0
 void OnNetworkVarSync(INetworkVar _VarInstance)
 {
     if (_VarInstance == m_PowerActive)
     {
         if (IsPowerActive)
         {
             if (EventFacilityPowerActivated != null)
             {
                 EventFacilityPowerActivated(gameObject);
             }
         }
         else
         {
             if (EventFacilityPowerDeactivated != null)
             {
                 EventFacilityPowerDeactivated(gameObject);
             }
         }
     }
 }
Пример #42
0
 void OnNetworkVarSync(INetworkVar _cSyncedNetworkVar)
 {
     if (_cSyncedNetworkVar == m_bIsFunctional)
     {
         if (IsFunctional)
         {
             if (EventComponentFix != null)
             {
                 EventComponentFix(this);
             }
         }
         else
         {
             if (EventComponentBreak != null)
             {
                 EventComponentBreak(this);
             }
         }
     }
 }
Пример #43
0
    void OnNetworkVarSync(INetworkVar _cVarInstance)
    {
        if (_cVarInstance == m_cCurrentCell)
        {
            if (m_cCurrentCell.Get() != null)
            {
                GameObject InsertedCell = CNetwork.Factory.FindObject(m_cCurrentCell.Get());
                InsertedCell.transform.position = transform.position + transform.up * 1.0f;
                InsertedCell.transform.rotation = transform.rotation;

                InsertedCell.GetComponent <CPartBehaviour>().EventModuleBroken += new CPartBehaviour.NotifyBroken(CellBroke);
                CellInserted();

                // Turn off  dynamic physics
                if (CNetwork.IsServer)
                {
                    InsertedCell.rigidbody.isKinematic = true;
                }
            }
        }
    }
Пример #44
0
	void OnNetworkVarSync(INetworkVar _cVarInstance)
    {
		if(_cVarInstance == m_cCurrentCell)
		{
			if(m_cCurrentCell.Get() != null)
			{
				GameObject InsertedCell = CNetwork.Factory.FindObject(m_cCurrentCell.Get());
				InsertedCell.transform.position = transform.position + transform.up * 1.0f;
				InsertedCell.transform.rotation = transform.rotation;
				
				InsertedCell.GetComponent<CPartBehaviour>().EventModuleBroken += new CPartBehaviour.NotifyBroken(CellBroke);
				CellInserted();
				
				// Turn off  dynamic physics
				if(CNetwork.IsServer)
				{
                	InsertedCell.rigidbody.isKinematic = true;
				}
			}
		}
	}
Пример #45
0
 public void OnNetworkVarSync(INetworkVar _rSender)
 {
     // Door State
     if (_rSender == m_DoorState)
     {
         if (DoorState == EDoorState.Opened)
         {
             if (EventDoorStateOpened != null)
             {
                 EventDoorStateOpened(gameObject);
             }
         }
         else if (DoorState == EDoorState.Closed)
         {
             if (EventDoorStateClosed != null)
             {
                 EventDoorStateClosed(gameObject);
             }
         }
     }
 }
Пример #46
0
 public void OnNetworkVarSync(INetworkVar _rSender)
 {
     // Boarding state
     if (_rSender == m_BoardingState)
     {
         if (BoardingState == EBoardingState.Onboard && m_CanBoard)
         {
             if (EventBoard != null)
             {
                 EventBoard();
             }
         }
         else if (BoardingState == EBoardingState.Offboard && m_CanDisembark)
         {
             if (EventDisembark != null)
             {
                 EventDisembark();
             }
         }
     }
 }
Пример #47
0
    void OnSyncHealth(INetworkVar sender)
    {
        if (syncNetworkHealth)
        {
            health_current = health_internal.Get();
        }

        if (stateTransitions != null)
        {
            byte currentState = (byte)stateTransitions.Length;

            for (int i = 0; i < stateTransitions.Length; ++i)
            {
                if (health_current < stateTransitions[i])
                {
                    currentState = (byte)i;
                    break;
                }
            }

            if (currentState != state)
            {
                state = currentState;
            }
        }

        if (EventOnSetHealth != null && health_current != health_previous)
        {
            EventOnSetHealth(gameObject, health_previous, health_current);
        }

        health_previous = health_current;

        if (health <= 0.0f && destroyOnZeroHealth)
        {
            CNetwork.Factory.DestoryObject(gameObject.GetComponent <CNetworkView>().ViewId);
            destroyOnZeroHealth = false;                // To be totes sure destroy doesn't get called again.
        }
    }
Пример #48
0
 public void OnNetworkVarSync(INetworkVar sender)
 {
     if (!CNetwork.IsServer)
     {
         if (Position && (sender == mPositionX || sender == mPositionY || sender == mPositionZ))
         {
             transform.position = new Vector3(mPositionX.Get(), mPositionY.Get(), mPositionZ.Get());
         }
         else if (Angle && (sender == mAngleX || sender == mAngleY || sender == mAngleZ))
         {
             transform.eulerAngles = new Vector3(mAngleX.Get(), mAngleY.Get(), mAngleZ.Get());
         }
         else if (PositionalVelocity && (sender == mPositionalVelocityX || sender == mPositionalVelocityY || sender == mPositionalVelocityZ))
         {
             rigidbody.velocity = new Vector3(mPositionalVelocityX.Get(), mPositionalVelocityY.Get(), mPositionalVelocityZ.Get());
         }
         else if (AngularVelocity && (sender == mAngularVelocityX || sender == mAngularVelocityY || sender == mAngularVelocityZ))
         {
             rigidbody.angularVelocity = new Vector3(mAngularVelocityX.Get(), mAngularVelocityY.Get(), mAngularVelocityZ.Get());
         }
     }
 }
Пример #49
0
    void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (m_bHighlighted == _cSyncedVar)
        {
            if (IsHighlighted)
            {
                if (!GetComponent <FracturedChunk>().FracturedObjectSource.HasDetachedChunks())
                {
                    renderer.enabled = true;
                }

                foreach (Material cMaterial in renderer.materials)
                {
                    cMaterial.color = Color.red;
                }
            }
            else
            {
                if (!GetComponent <FracturedChunk>().FracturedObjectSource.HasDetachedChunks())
                {
                    renderer.enabled = false;
                }

                foreach (Material cMaterial in renderer.materials)
                {
                    cMaterial.color = Color.white;
                }
            }
        }

        if (_cSyncedVar == m_bAlive)
        {
            if (!IsAlive)
            {
                GetComponent <FracturedChunk>().DetachFromObject(false);
            }
        }
    }
Пример #50
0
    public void OnNetworkVarSync(INetworkVar _cVarInstance)
    {
        if (_cVarInstance == m_ulOwnerPlayerId)
        {
			if (IsHeld)
            {
                GameObject cOwnerPlayerActor = OwnerPlayerActor;
              
                Transform[]children = OwnerPlayerActor.GetComponentsInChildren<Transform>();
                foreach(Transform child in children)
                {
                    if(child.name == "RightHandIndex2")
                    {
                        gameObject.transform.parent = child;
                    }
                }     

                if(gameObject.transform.parent.gameObject == null)
                {
                    Debug.LogError("Could not find right hand transform of player model!");
                }

                gameObject.transform.localPosition = new Vector3(0.0f,0.0f,0.0f);
              
                // Turn off dynamic physics
				if(CNetwork.IsServer)
				{
                	rigidbody.isKinematic = true;
					rigidbody.detectCollisions = false;
				}

				// Stop recieving syncronizations
                GetComponent<CActorNetworkSyncronized>().m_SyncPosition = false;
				GetComponent<CActorNetworkSyncronized>().m_SyncRotation = false;
            }
            else
            {
                gameObject.transform.parent = null;

                // Turn on dynamic physics
				if(CNetwork.IsServer)
				{
					rigidbody.isKinematic = false;
					rigidbody.detectCollisions = true;
				}
				
                rigidbody.AddForce(transform.forward * 5.0f, ForceMode.VelocityChange);
                rigidbody.AddForce(Vector3.up * 5.0f, ForceMode.VelocityChange);

				// Recieve syncronizations
				GetComponent<CActorNetworkSyncronized>().m_SyncPosition = true;
				GetComponent<CActorNetworkSyncronized>().m_SyncRotation = true;
            }
        }
    }
Пример #51
0
	public void OnNetworkVarSync(INetworkVar _VarInstance)
	{
		
	}
 private void OnNetworkVarSync(INetworkVar _VarInstance)
 {
 }
Пример #53
0
 public void OnNetworkVarSync(INetworkVar _cSyncedVar)
 {
     // Empty
 }
Пример #54
0
	void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
		if (_cSyncedVar == m_cTargetAsteroidViewId)
		{
            // Un-highlight previous
			if (m_cTargetAsteroidViewId.GetPrevious() != null &&
                m_cTargetAsteroidViewId.GetPrevious().GameObject != null)
			{
				m_cTargetAsteroidViewId.GetPrevious().GameObject.GetComponent<CAsteroidChunkBehaviour>().SetHighlighted(false);
			}

            // Highlight new target
			if (m_cTargetAsteroidViewId.Get() != null)
			{
				m_cTargetAsteroidViewId.Get().GameObject.GetComponent<CAsteroidChunkBehaviour>().SetHighlighted(true);
			}
		}
		else if (_cSyncedVar == m_bFractureLaserVisible)
		{
            if (m_bFractureLaserVisible.Get())
            {
                // Show laser
                m_cFractureLaserObject.SetActive(true);
            }
            else
            {
                // Hide laser
				m_cFractureLaserObject.SetActive(false);
            }
		}
		else if (_cSyncedVar == m_bExtractorBeamVisible)
		{
            if (m_bExtractorBeamVisible.Get())
            {
                // Show laser
				m_cExtractorBeamObject.SetActive(true);
            }
            else
            {
                // Hide laser
				m_cExtractorBeamObject.SetActive(false);
            }
		}
	}
Пример #55
0
	void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
		// Empty
	}
Пример #56
0
	void OnNetworkVarSync(INetworkVar _cSyncedVar)
	{
	}
Пример #57
0
    void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_EnviromentalOxygen)
        {
            if (EventEnviromentalOxygenChange != null) 
				EventEnviromentalOxygenChange(m_EnviromentalOxygen.Value);
        }
    }
Пример #58
0
	public void OnNetworkVarSync(INetworkVar _SyncedVar)
	{

	}
Пример #59
0
 void OnNetworkVarSync(INetworkVar _cVarInstance)
 {
     // Do nothing
 }
Пример #60
0
 void OnNetworkVarSync(INetworkVar _cVarInstance)
 {
 }