void OnTriggerEnter(Collider c) { EAActor pAttackedActor = c.gameObject.GetComponent <EAActor>(); EAActor pActor = GetOwnerActor(); if (pAttackedActor != null) { // [4/11/2018 puos] attacker is not dead if (pActor != null) { if (pActor.GetCharBase().GetObjID() != pAttackedActor.GetCharBase().GetObjID()) { EA_GameEvents.onAttackMsg(pActor.GetCharBase(), pAttackedActor.GetCharBase(), WeaponInfo, GetItemBase().GetObjID()); } else { // [12/2/2019 puos] If attacker and attacked are the same, passing return; } } else { EA_GameEvents.onAttackMsg(null, pAttackedActor.GetCharBase(), WeaponInfo, GetItemBase().GetObjID()); } } if (WeaponInfo.onExplosionEvent != null) { WeaponInfo.onExplosionEvent(GetItemBase().GetObjID()); } }
public virtual void SetLinkActor(EAActor pLinkActor) { if (m_pLinkActor != pLinkActor && pLinkActor != null) { m_pLinkActor = pLinkActor; m_pLinkActor.SetCharBase(this); } }
public virtual void SetLinkActor(EAActor pActor) { if (pActor != null) { actorSendEvent -= pActor.OnAction; actorSendEvent += pActor.OnAction; pActor.actorInputSendEvent -= OnActorRecieveEvent; pActor.actorInputSendEvent += OnActorRecieveEvent; } }
/// <summary> /// Change if there are set parts /// </summary> /// <returns></returns> public override bool ChangeParts() { EAActor actor = GetLinkIActor(); if (actor != null) { actor.FindParts(m_ActorInfo.m_PartTblId); } return(true); }
public virtual void OnAction(params object[] parms) { if (m_pLinkActor != null) { EAActor pActor = m_pLinkActor.gameObject.GetComponent <EAActor>(); if (pActor != null) { pActor.OnAction(parms); } } }
public void OnActorInputSendEvent(params object[] command) { if (m_pLinkActor != null) { EAActor pActor = m_pLinkActor.gameObject.GetComponent <EAActor>(); if (pActor != null) { pActor.OnActorInputSendEvent(command); } } }
/// <summary> /// Id of the weapon owner /// </summary> /// <returns></returns> public EAObjID GetOwnerActorId() { EAObjID OwnActorId = CObjGlobal.InvalidObjID; EAActor pActor = GetOwnerActor(); if (pActor != null && pActor.GetCharBase() != null) { OwnActorId = pActor.GetCharBase().GetObjID(); } return(OwnActorId); }
// Find an object inside an actor. public override GameObject GetObjectInActor(string szBoneName) { if (m_pLinkActor != null) { EAActor pActor = m_pLinkActor.gameObject.GetComponent <EAActor>(); if (pActor != null) { return(pActor.GetObjectInActor(szBoneName)); } } return(null); }
/// <summary> /// /// </summary> /// <param name="pAttackedActor"></param> protected void Slice(EAActor pAttackedActor) { EAActor pActor = GetOwnerActor(); // [4/11/2018 puos] bug fixed attacker dies if (pAttackedActor != null) { if (pActor != null) { // [4/18/2018 puos] Collided object must not be self if (pActor.GetCharBase().GetObjID() != pAttackedActor.GetCharBase().GetObjID()) { EA_GameEvents.onAttackMsg(pActor.GetCharBase(), pAttackedActor.GetCharBase(), GetAttackWeaponInfo(), CObjGlobal.InvalidObjID); } } else { EA_GameEvents.onAttackMsg(null, pAttackedActor.GetCharBase(), GetAttackWeaponInfo(), CObjGlobal.InvalidObjID); } } }
public void FireShoot() { EAActor pActor = GetOwnerActor(); Debug.Assert(pActor != null, "FireShoot Actor is null"); if (fireDummyObject != null && pActor != null) { ObjectInfo ObjInfo = new ObjectInfo(); ObjInfo.spawnPos[0] = fireDummyObject.transform.position.x; ObjInfo.spawnPos[1] = fireDummyObject.transform.position.y; ObjInfo.spawnPos[2] = fireDummyObject.transform.position.z; ObjInfo.spawnAngle[0] = fireDummyObject.transform.rotation.eulerAngles.x; ObjInfo.spawnAngle[1] = fireDummyObject.transform.rotation.eulerAngles.y; ObjInfo.spawnAngle[2] = fireDummyObject.transform.rotation.eulerAngles.z; ObjInfo.m_ModelTypeIndex = WeaponInfo.uProjectileModelType; ObjInfo.m_objClassType = WeaponInfo.m_objProjectileClassType; ObjInfo.SetObjName("projectile"); ItemObjInfo itemInfo = new ItemObjInfo(); EA_CCharBPlayer pCharBase = pActor.GetCharBase(); if (pCharBase != null) { itemInfo.m_HavenUser = pCharBase.GetObjID(); } if (ObjInfo.m_objClassType == default(Type)) { ObjInfo.m_objClassType = typeof(EAProjectile); } itemInfo.m_eItemType = eItemObjType.IK_Projectile; EA_CItem pItem = EACObjManager.instance.CreateItem(ObjInfo, itemInfo); // Create if no bullet. Do not use pool if (pItem.GetLinkEntity() == null) { GameObject pGameObject = new GameObject("projectile", ObjInfo.m_objClassType); pGameObject.transform.position = new Vector3(ObjInfo.spawnPos[0], ObjInfo.spawnPos[1], ObjInfo.spawnPos[2]); pGameObject.transform.eulerAngles = new Vector3(ObjInfo.spawnAngle[0], ObjInfo.spawnAngle[1], ObjInfo.spawnAngle[2]); pItem.SetLinkEntity(pGameObject); pItem.SetLinkItem(pGameObject.GetComponent <EAProjectile>()); } GameObject item = pItem.GetLinkEntity(); EAProjectile pProjectile = null; if (item != null) { pProjectile = item.GetComponent <EAProjectile>(); } if (pProjectile != null) { if (ProjectileTransform.instance != null) { pProjectile.transform.SetParent(ProjectileTransform.instance.transform); } // use sphereCollider Collider c = pProjectile.GetComponent <Collider>(); if (c == null) { SphereCollider sc = pProjectile.gameObject.AddComponent <SphereCollider>(); sc.radius = WeaponInfo.projectileRadius; } pProjectile.SetProjectileDir(fireDummyObject.transform.forward); pProjectile.SetOwnActor(itemInfo.m_HavenUser); pProjectile.SetWeapon(GetItemBase().GetObjID()); pProjectile.SetWeaponInfo(WeaponInfo); Debug.Log("fire shoot - weapon user id :" + itemInfo.m_HavenUser + " projectile type : " + WeaponInfo.projectileType); } pItem.Use(); } }
/// <summary> /// /// </summary> private void RayProjectileType() { Ray ray = new Ray(transform.position, m_vDir); List <RaycastHit> hits = new List <RaycastHit>(); EACObjManager.instance.For(x => { GameObject obj = x.GetLinkEntity(); if (obj != null) { float distance = (obj.transform.position - transform.position).magnitude; if (distance <= WeaponInfo.fKillDistance) { Collider c = x.collider; if (c != null) { RaycastHit hitInfo; if (c.Raycast(ray, out hitInfo, WeaponInfo.fKillDistance)) { hits.Add(hitInfo); } } } } return(false); }); if (hits != null && 0 < hits.Count) { hits.Sort(delegate(RaycastHit a, RaycastHit b) { // 3 decimal places return((int)((a.distance - b.distance) * 1000)); }); EAActor pActor = GetOwnerActor(); foreach (RaycastHit hit in hits) { if (hit.collider != null) { Collider c = hit.collider; EAActor pAttackedActor = c.gameObject.GetComponent <EAActor>(); if ((pActor && pAttackedActor) && (pActor.GetCharBase().GetObjID() != pAttackedActor.GetCharBase().GetObjID())) { OnTriggerEnter(c); break; } } } } ExPlosion(); }
public static bool EntitySetting(EA_CObjectBase pSetObject, ObjectInfo SetObjinfo) { if (null == pSetObject) { Debug.Log("EntitySetting pSetObject is null :" + SetObjinfo.m_strGameName); return(false); } if (eObjectState.CS_SETENTITY != SetObjinfo.m_eObjState) { return(false); } string poolType = SetObjinfo.m_ModelTypeIndex; GameObject pGameObject = CObjResourcePoolingManager.instance.Spwan(poolType); pSetObject.SetLinkEntity(pGameObject); if (pGameObject == null) { Debug.LogError("EntitySetting Game object is invalid. type : " + poolType + ", name : " + pSetObject.GetObjInfo().m_strGameName); return(false); } // Modify class creation logic [3/30/2018 puos] if (SetObjinfo.m_objClassType != default(Type)) { if (pGameObject.GetComponent(SetObjinfo.m_objClassType) == null) { pGameObject.AddComponent(SetObjinfo.m_objClassType); } } // Create around object table switch (SetObjinfo.m_eObjType) { case eObjectType.CT_NPC: case eObjectType.CT_MONSTER: case eObjectType.CT_PLAYER: case eObjectType.CT_MYPLAYER: { EAActor actor = pGameObject.GetComponent <EAActor>(); if (actor == null) { actor = pGameObject.AddComponent <EAActor>(); SetObjinfo.m_objClassType = typeof(EAActor); } ((EA_CCharBPlayer)pSetObject).SetLinkActor(actor); } break; case eObjectType.CT_MAPOBJECT: { EAMapObject mapObject = pGameObject.GetComponent <EAMapObject>(); if (mapObject == null) { mapObject = pGameObject.AddComponent <EAMapObject>(); SetObjinfo.m_objClassType = typeof(EAMapObject); } ((EA_CMapObject)pSetObject).SetLinkMapObject(mapObject); } break; case eObjectType.CT_ITEMOBJECT: { EAItem itemObject = pGameObject.GetComponent <EAItem>(); if (itemObject == null) { itemObject = pGameObject.AddComponent <EAItem>(); SetObjinfo.m_objClassType = typeof(EAItem); } ((EA_CItem)pSetObject).SetLinkItem(itemObject); } break; } //Debug.Log("EntitySetting pSetObject :" + SetObjinfo.m_ModelTypeIndex); return(true); }