private void InitBulletPosAndForward(AbilityTriggerBullet bullet, out Vector3 startPos) { Vector3 forward; Vector3 zero = Vector3.zero; if (this.config.RandomPosPool.Length > 0) { this.randPosIx = ((this.randPosIx + 1) != this.config.RandomPosPool.Length) ? (this.randPosIx + 1) : 0; float[] numArray = this.config.RandomPosPool[this._posIndexOrderList[this.randPosIx]]; zero = new Vector3(numArray[0], numArray[1], numArray[2]); } startPos = bullet.triggerBullet.transform.TransformPoint(zero) - bullet.triggerBullet.transform.localPosition; Transform transform = bullet.triggerBullet.transform; transform.position += startPos; BaseMonoEntity entity = this._attackTarget; if ((entity == null) || !this.config.FaceTarget) { forward = base.entity.transform.forward; } else { forward = entity.GetAttachPoint("RootNode").position - bullet.triggerBullet.transform.position; } bullet.triggerBullet.transform.forward = forward; if (this.config.BackDistance > 0f) { Transform transform2 = bullet.triggerBullet.transform; transform2.position += (Vector3)(forward.normalized * this.config.BackDistance); } }
public void SetupSkinmesh(BaseMonoEntity entity) { SkinnedMeshRenderer component = entity.GetAttachPoint(this.skinMeshAttachPoint).GetComponent <SkinnedMeshRenderer>(); if (component != null) { this._shapeModule.skinnedMeshRenderer = component; } }
public override void OnAbilityTriggered(EvtAbilityStart evt) { string bulletTypeName = this.config.BulletTypeName; int grenadeAmount = this.config.GrenadeAmount; string hitAnimEventID = this.config.HitAnimEventID; GrenadesMixinArgument abilityArgument = evt.abilityArgument as GrenadesMixinArgument; if (abilityArgument != null) { grenadeAmount = abilityArgument.BulletAmount; if (!string.IsNullOrEmpty(abilityArgument.HitAnimEventID)) { hitAnimEventID = abilityArgument.HitAnimEventID; } } for (int i = 0; i < grenadeAmount; i++) { AbilityTriggerBullet bullet = Singleton <DynamicObjectManager> .Instance.CreateAbilityLinearTriggerBullet(bulletTypeName, base.actor, base.instancedAbility.Evaluate(this.config.BulletSpeed), this.config.Targetting, this.config.IgnoreTimeScale, Singleton <DynamicObjectManager> .Instance.GetNextSyncedDynamicObjectRuntimeID(), -1f); if ((this.config.BulletEffect != null) && (this.config.BulletEffect.EffectPattern != null)) { Singleton <EffectManager> .Instance.TriggerEntityEffectPattern(this.config.BulletEffect.EffectPattern, bullet.triggerBullet, this.config.BulletEffectGround); } BaseMonoEntity entity = null; Vector3 forward = base.entity.transform.forward; if (evt.otherID != 0) { BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.otherID); if ((actor != null) && (actor.entity != null)) { entity = actor.entity; } } if (entity != null) { bullet.triggerBullet.transform.position = entity.GetAttachPoint("RootNode").position; forward = entity.transform.forward; float angle = ((360 * i) / (this.config.GrenadeAmount + 1)) - 180; forward = (Vector3)(Quaternion.AngleAxis(angle, Vector3.up) * forward); } this.InitBulletDirAndPos(bullet, forward); base._bulletAttackDatas.Add(bullet.runtimeID, DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(base.actor, hitAnimEventID)); } }
protected override void InitBulletForward(AbilityTriggerBullet bullet) { Vector3 forward; BaseMonoEntity attackTarget = base.entity.GetAttackTarget(); if ((attackTarget == null) || !this.config.FaceTarget) { forward = base.entity.transform.forward; } else { forward = attackTarget.GetAttachPoint("RootNode").position - bullet.triggerBullet.transform.position; Quaternion from = Quaternion.LookRotation(base.entity.transform.forward); Quaternion to = Quaternion.LookRotation(forward); forward = (Vector3)(Quaternion.RotateTowards(from, to, 15f) * Vector3.forward); } bullet.triggerBullet.transform.forward = forward; }
private AttackResult.HitCollsion CalcHitCollision(ConfigPropObject.E_RetreatType retreatType, BaseMonoEntity victimEntity) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion(); if (retreatType == ConfigPropObject.E_RetreatType.Spike) { RaycastHit hit; collsion.hitPoint = victimEntity.GetAttachPoint("RootNode").position; Vector3 origin = victimEntity.transform.position + ((Vector3)(Vector3.up * 0.5f)); Vector3 direction = this.prop.transform.position - origin; if (Physics.Raycast(origin, direction, out hit, 10f, ((int)1) << InLevelData.PROP_LAYER)) { collsion.hitDir = hit.normal; } return(collsion); } collsion.hitPoint = base.entity.GetAttachPoint("RootNode").position; collsion.hitDir = base.entity.XZPosition - this.prop.XZPosition; return(collsion); }
private bool OnHittingOther(EvtHittingOther evt) { if (evt.attackData == null) { evt.attackData = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(this, evt.animEventID); } if ((evt.attackData.hitCollision == null) && (evt.hitCollision != null)) { evt.attackData.hitCollision = evt.hitCollision; } else if (((evt.hitCollision == null) && (evt.attackData.hitCollision == null)) && (Singleton <EventManager> .Instance.GetActor(evt.toID) != null)) { BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.toID); AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = entity.GetAttachPoint("RootNode").position, hitDir = entity.XZPosition - this.monster.XZPosition }; evt.hitCollision = collsion; } return(true); }
protected virtual void InitBulletForward(AbilityTriggerBullet bullet) { Vector3 forward; BaseMonoEntity attackTarget = base.entity.GetAttackTarget(); if ((attackTarget == null) || !this.baseConfig.FaceTarget) { forward = base.entity.transform.forward; } else { forward = attackTarget.GetAttachPoint("RootNode").position - bullet.triggerBullet.transform.position; Quaternion from = Quaternion.LookRotation(base.entity.transform.forward); Quaternion to = Quaternion.LookRotation(forward); forward = (Vector3)(Quaternion.RotateTowards(from, to, 15f) * Vector3.forward); } if (this.baseConfig.IsFixedHeight) { forward.y = 0f; } bullet.triggerBullet.transform.forward = forward; bullet.triggerBullet.IgnoreTimeScale = this.baseConfig.IgnoreTimeScale; }
public void SetMoveToTarget(BaseMonoEntity toEntity) { this._targetTransform = toEntity.GetAttachPoint(this.ToAttachPoint); }