idTech4.Game.idEntity.BecomeInactive C# (CSharp) Method

BecomeInactive() public method

public BecomeInactive ( EntityThinkFlags flags ) : void
flags EntityThinkFlags
return void
		public void BecomeInactive(EntityThinkFlags flags)
		{
			if((flags & EntityThinkFlags.Physics) == EntityThinkFlags.Physics)
			{
				// may only disable physics on a team master if no team members are running physics or bound to a joints
				if(_teamMaster == this)
				{
					idConsole.Warning("TODO: teamMaster");
		
					/*for ( idEntity *ent = teamMaster->teamChain; ent; ent = ent->teamChain ) {
						if ( ( ent->thinkFlags & TH_PHYSICS ) || ( ( ent->bindMaster == this ) && ( ent->bindJoint != INVALID_JOINT ) ) ) {
							flags &= ~TH_PHYSICS;
							break;
						}
					}*/
				}
			}

			if(_thinkFlags != 0)
			{
				_thinkFlags &= ~flags;

				if((_thinkFlags == 0) && (this.IsActive == true))
				{
					idR.Game.EntitiesToDeactivate++;
				}
			}

			if((flags & EntityThinkFlags.Physics) == EntityThinkFlags.Physics)
			{
				// if this entity has a team master
				if((_teamMaster != null) && (_teamMaster != this))
				{
					// if the team master is at rest
					if(_teamMaster.IsAtRest == true)
					{
						_teamMaster.BecomeInactive(EntityThinkFlags.Physics);
					}
				}
			}
		}

Usage Example

Example #1
0
        public void BecomeInactive(EntityThinkFlags flags)
        {
            if ((flags & EntityThinkFlags.Physics) == EntityThinkFlags.Physics)
            {
                // may only disable physics on a team master if no team members are running physics or bound to a joints
                if (_teamMaster == this)
                {
                    idConsole.Warning("TODO: teamMaster");

                    /*for ( idEntity *ent = teamMaster->teamChain; ent; ent = ent->teamChain ) {
                     *      if ( ( ent->thinkFlags & TH_PHYSICS ) || ( ( ent->bindMaster == this ) && ( ent->bindJoint != INVALID_JOINT ) ) ) {
                     *              flags &= ~TH_PHYSICS;
                     *              break;
                     *      }
                     * }*/
                }
            }

            if (_thinkFlags != 0)
            {
                _thinkFlags &= ~flags;

                if ((_thinkFlags == 0) && (this.IsActive == true))
                {
                    idR.Game.EntitiesToDeactivate++;
                }
            }

            if ((flags & EntityThinkFlags.Physics) == EntityThinkFlags.Physics)
            {
                // if this entity has a team master
                if ((_teamMaster != null) && (_teamMaster != this))
                {
                    // if the team master is at rest
                    if (_teamMaster.IsAtRest == true)
                    {
                        _teamMaster.BecomeInactive(EntityThinkFlags.Physics);
                    }
                }
            }
        }