public CDamageInfo(int iDamage, EDamageType eType, CBaseEntity pAttacker, Vector3 vDmgPosition) { m_iDamage = m_iBaseDamage = iDamage; m_pAttacker = pAttacker; m_vDamagePosition = vDmgPosition; m_eDamageType = eType; }
/**************************************************************************************** * Public helper functions ***************************************************************************************/ bool FilterEntity(CBaseEntity pEnt) { bool bResult = false; if (pEnt != null) { switch (m_eFilterMode) { case EFilterMode.Normal: bResult = FilterEntityNorm(pEnt); break; case EFilterMode.Inverted: bResult = !FilterEntityNorm(pEnt); break; case EFilterMode.Random: bResult = NRand.randBool(m_flRandomChance); break; case EFilterMode.AllowAll: bResult = true; break; case EFilterMode.BlockAll: bResult = false; break; } } return(bResult); }
public CDamageInfo(int iDamage, CBaseEntity pAttacker, Vector3 vDmgPosition, Vector3 vForce) { m_iDamage = m_iBaseDamage = iDamage; m_pAttacker = pAttacker; m_vDamagePosition = vDmgPosition; m_vForce = vForce; }
private static bool Hook_Use(CBaseEntity pEnt, CBaseController pController) { if (pEnt.GetOffsetTo(pController).magnitude < pEnt.m_flInputEventRadius) { return(pEnt.Use(pController)); } return(false); }
public CDamageInfo(int iDamage, int iMinDmg, int iMaxDmg, CBaseEntity pAttacker, Vector3 vDmgPosition) { m_iDamage = m_iBaseDamage = iDamage; m_pAttacker = pAttacker; m_vDamagePosition = vDmgPosition; m_iMinDamage = iMinDmg; m_iMaxDamage = iMaxDmg; }
private void OnTriggerEnter(Collider collider) { CBaseEntity pEnt = g.ToBaseEntity(collider.gameObject); if (pEnt != null) { pEnt.SetIsTouchedByController(true); m_pColliding.Add(pEnt); } }
public CDamageInfo(int iDamage, int iMinDmg, int iMaxDmg, EDamageType eType, CBaseEntity pAttacker, Vector3 vDmgPosition, Vector3 vForce) { m_iDamage = m_iBaseDamage = iDamage; m_pAttacker = pAttacker; m_vDamagePosition = vDmgPosition; m_vForce = vForce; m_iMinDamage = iMinDmg; m_iMaxDamage = iMaxDmg; m_eDamageType = eType; }
private void OnTriggerExit(Collider collider) { CBaseEntity pEnt = g.ToBaseEntity(collider.gameObject); if (pEnt != null) { pEnt.SetIsTouchedByController(false); m_pColliding.Remove(pEnt); pEnt.ForceDrop(this); } }
public void AddFlagToChildren(int iFlag) { for (int i = 0; i < GetTransform().childCount; i++) { CBaseEntity pEnt = g.ToBaseEntity(GetTransform().GetChild(i).gameObject); if (pEnt != null) { pEnt.AddFlags(iFlag); pEnt.AddFlagToChildren(iFlag); } } }
public static CBaseEntity ToBaseEntity(string objName) { CBaseEntity result = null; foreach (CBaseEntity pEnt in CBaseEntity.g_aEntList) { if (pEnt.obj().name.Equals(objName)) { result = pEnt; break; } } return(result); }
public override void OnUsed(CBaseEntity pUser) { base.OnUsed(pUser); CBaseController controller = pUser as CBaseController; if (controller != null) { if (controller.ButtonsPressed().HasButton(g.IN_TRIGGER)) { obj().GetComponent <MeshRenderer>().material = m_pToggledMaterial; } else { obj().GetComponent <MeshRenderer>().material = m_pStartingMaterial; } } }
/** * Sets all entities to their default health and spawn flags. * Does this by calling Respawn() on all entities. */ static void ReloadAllEntities() { for (int i = 0; i < g_aEntList.Count; i++) { CBaseEntity pEnt = g_aEntList[i]; if (pEnt != null) { if (pEnt.HasFlag(FL_DESTROY_ON_RESPAWN)) { Destroy(pEnt.obj()); } else { pEnt.Respawn(); } } } }
public void Start(CBaseController pController, CBaseEntity pEnt) { //builds flags from our booleans ulong pressPressedFlags = m_pPressPressed.GetFlags(); ulong pressReleasedFlags = m_pPressReleased.GetFlags(); ulong touchPressedFlags = m_pTouchPressed.GetFlags(); ulong touchReleasedFlags = m_pTouchReleased.GetFlags(); CButtonSet touch = pController.ButtonsTouched(); CButtonSet press = pController.ButtonsPressed(); //iterate through all the buttons if (pEnt.m_bInputEventsTriggersUse) { EntityControllerInputEvent input = new EntityControllerInputEvent(); input.m_pEnt = pEnt; input.m_pFunction = CBaseEntity.Hook_Use; for (int i = 0; i < g.IN_NUM_BUTTONS; i++) { CButton b = press.m_pButtons[i]; if ((pressPressedFlags & b.m_iFlag) > 0) { b.m_pPressedEvents.Add(input); } if ((pressReleasedFlags & b.m_iFlag) > 0) { b.m_pReleasedEvents.Add(input); } } for (int i = 0; i < g.IN_NUM_BUTTONS; i++) { CButton b = touch.m_pButtons[i]; if ((touchPressedFlags & b.m_iFlag) > 0) { b.m_pPressedEvents.Add(input); } if ((touchReleasedFlags & b.m_iFlag) > 0) { b.m_pReleasedEvents.Add(input); } } } }
bool FilterEntityNorm(CBaseEntity pEnt) { bool result = false; switch (m_eFilterType) { case EFilterType.ByName: result = pEnt.name.Equals(m_sTextComparator); break; case EFilterType.ByTag: result = pEnt.CompareTag(m_sTextComparator); break; case EFilterType.ByIsActive: result = pEnt.obj().activeInHierarchy; break; case EFilterType.ByIsVisible: Renderer pRenderer = pEnt.obj().GetComponent <Renderer>(); if (pRenderer != null) { result = pRenderer.enabled; } break; case EFilterType.ByIsSolid: Collider pCollider = pEnt.obj().GetComponent <Collider>(); if (pCollider != null) { result = pCollider.enabled; } break; case EFilterType.ByIsPhysicsSimulated: Rigidbody pBody = pEnt.obj().GetComponent <Rigidbody>(); result = pBody != null; break; } return(result); }
public bool Use(CBaseEntity pUser) { bool bUsed = IsUseable(); if (bUsed) { if (m_bUseTogglesPickup && pUser is CBaseController) { if (!m_bIsPickedUp || !HasParent() || pUser != GetParent()) { Pickup(pUser as CBaseController); } else { Drop(pUser as CBaseController); } } OnUsed(pUser); } return(bUsed); }
public Vector3 GetOffsetTo(CBaseEntity pEnt) { return(GetOffsetTo(pEnt.GetAbsOrigin())); }
public bool ToggleBlockDrop(CBaseEntity pEnt, CBaseController pController) { m_bDropBlocks = !m_bDropBlocks; return(true); }
public bool ToggleMusic(CBaseEntity pEnt, CBaseController pController) { m_bMuteStatus = !m_bMuteStatus; m_pMusicSource.mute = !m_pMusicSource.mute; return(true); }
public Quaternion GetAngleTo(CBaseEntity pEnt) { return(Quaternion.LookRotation(GetOffsetTo(pEnt.GetAbsOrigin()))); }
/**************************************************************************************** * Aliases for transform parenting ***************************************************************************************/ public void SetParent(CBaseEntity pParent) { GetTransform().parent = pParent.GetTransform(); }
public virtual void OnUsed(CBaseEntity pUser) { }
public bool CanSee(CBaseEntity pEnt) { return(Physics.Raycast(GetPosition(), pEnt.GetPosition() - GetPosition())); }