public static ConvertedItem SetupGameObject(this HitTarget hitTarget, GameObject obj) { var mainAuthoring = obj.AddComponent <HitTargetAuthoring>().SetItem(hitTarget); var meshAuthoring = new List <IItemMeshAuthoring>(); HitTargetColliderAuthoring colliderAuthoring = null; switch (hitTarget.SubComponent) { case ItemSubComponent.None: colliderAuthoring = obj.AddColliderComponent(hitTarget); meshAuthoring.Add(obj.AddComponent <HitTargetMeshAuthoring>()); break; case ItemSubComponent.Collider: { Logger.Warn("Cannot parent a target collider to a different object than a target!"); break; } case ItemSubComponent.Mesh: { Logger.Warn("Cannot parent a target mesh to a different object than a target!"); break; } default: throw new ArgumentOutOfRangeException(); } obj.AddComponent <ConvertToEntity>(); return(new ConvertedItem(mainAuthoring, meshAuthoring, colliderAuthoring)); }
/// ******************************************************* /// <summary>当たり対象があるか</summary> /// <returns>true:ある/false:無い</returns> /// ******************************************************* protected override bool HitCheck() { if (HitTarget == null) { return(false); } if (HitTarget.Count == 0) { return(false); } HitTarget.ForEach(trg => { if (trg.Position.y >= Position.y) { IsUpperHit = true; } ToughPoint -= trg.AttackPoint; }); if (IsUpperHit == true) { RemoveField(); return(true); } if (ToughPoint < 0) { RemoveField(); return(true); } HitTarget.Clear(); return(false); }
public void SendTargetsToServer(CollectTargetsInRadius evt, ExplosiveMassEffectNode effect, SelfTankNode tank) { SelfHitEvent eventInstance = new SelfHitEvent { Targets = new List <HitTarget>() }; foreach (Entity entity in evt.Targets) { Entity tankIncarnation = entity.SendEvent <GetTankIncarnationEvent>(new GetTankIncarnationEvent()).TankIncarnation; if (tankIncarnation != null) { HitTarget item = new HitTarget { Entity = entity, LocalHitPoint = Vector3.zero, HitDirection = Vector3.zero, HitDistance = 0f, IncarnationEntity = tankIncarnation, TargetPosition = Vector3.zero }; eventInstance.Targets.Add(item); } } base.ScheduleEvent <SynchronizeSelfTankPositionBeforeEffectEvent>(tank); base.ScheduleEvent(eventInstance, effect); }
private void HitObject(HitTarget hitTarget, Rigidbody hitRigidbody) { hitSound.Play(transform.position); if (triggerEffectsOnEachHit || hitCount >= hits) { if (hitTarget != null) { foreach (var effect in hitTargetEffects) { effect.Hit(this, hitTarget); hitTarget.HitEffectTaken(this, effect); } hitTarget.HitTaken(this); } if (hitRigidbody != null) { foreach (var effect in hitRigidbodyEffects) { effect.Hit(this, hitRigidbody); } } } }
public HitResult(Win2DRenderNode renderNode, HitTarget target) { Guard.NotNull(renderNode, nameof(renderNode)); this.renderNode = renderNode; this.target = target; }
public void RegisterHitTarget(HitTarget hitTarget, Entity entity, GameObject go) { var hitTargetApi = new HitTargetApi(hitTarget, entity, this); _tableApi.HitTargets[hitTarget.Name] = hitTargetApi; _initializables.Add(hitTargetApi); _hittables[entity] = hitTargetApi; }
internal static IVpxPrefab InstantiatePrefab(this HitTarget hitTarget) { var prefab = hitTarget.Data.IsDropTarget ? RenderPipeline.Current.PrefabProvider.CreateDropTarget(hitTarget.Data.TargetType) : RenderPipeline.Current.PrefabProvider.CreateHitTarget(hitTarget.Data.TargetType); return(new VpxPrefab <HitTarget, HitTargetData, TargetComponent>(prefab, hitTarget)); }
public static HitTarget Create(BeatInfo beatinfo) { GameObject newTargetObj = Instantiate(Resources.Load("Prefabs/Hit Target")) as GameObject; HitTarget newTarget = newTargetObj.GetComponent <HitTarget>(); newTarget.SetBeatInfo(beatinfo); return(newTarget); }
/// ******************************************************* /// <summary>当たり対象があるか</summary> /// <returns>true:ある/false:無い</returns> /// ******************************************************* protected override bool HitCheck() { if (HitTarget == null) { return(false); } HitTarget.Clear(); return(false); }
public override void HitTaken(HitTarget target, HitTrigger trigger) { if (target.HP <= 0) { var scrap = GameObject.Instantiate(scrapPrefabs.PickRandom <CollectableScrap>(), target.transform.position, Random.rotation); scrap.rigidbody.AddForce(scrap.rigidbody.velocity + Random.onUnitSphere * randomVelocity, ForceMode.VelocityChange); scrap.rigidbody.AddTorque(3 * Random.onUnitSphere, ForceMode.VelocityChange); } }
public void AddHitTarget( HitTarget hittarget ) { if( bAddingNames ) { //Test.Debug("adding name " + hittarget.ToString() ); hittargets.Add( hittarget ); Gl.glLoadName( hittargets.Count ); // note: this isnt quite the index; it is index + 1 } }
public void AddHitTarget(HitTarget hittarget) { if (bAddingNames) { //Test.Debug("adding name " + hittarget.ToString() ); hittargets.Add(hittarget); Gl.glLoadName(hittargets.Count); // note: this isnt quite the index; it is index + 1 } }
private void MakeImpactOnAnyAimingShot(float aimingHitPower, List <HitTarget> targets, ShaftAimingImpactNode weapon) { float maxImpactForce = (weapon.shaftAimingImpact.MaxImpactForce - weapon.impact.ImpactForce) * aimingHitPower; int count = targets.Count; for (int i = 0; i < count; i++) { HitTarget target = targets[i]; base.PrepareImpactForHitTarget(weapon.Entity, target, maxImpactForce, 1f); } }
public override void HitTaken(HitTarget target, HitTrigger trigger) { if (trigger.source != null) { var playerMotor = trigger.source.GetComponent <PlayerMotor>(); if (playerMotor != null) { playerMotor.FillSteam(2); } } }
protected void PrepareImpactForHitTarget(Entity weaponDamager, HitTarget target, float maxImpactForce, float weakeningCoeff = 1f) { ImpactEvent eventInstance = new ImpactEvent { Force = ((Vector3.Normalize(target.HitDirection) * maxImpactForce) * WeaponConstants.WEAPON_FORCE_MULTIPLIER) * weakeningCoeff, LocalHitPoint = target.LocalHitPoint, WeakeningCoeff = weakeningCoeff }; Entity[] entities = new Entity[] { target.Entity, weaponDamager }; base.NewEvent(eventInstance).AttachAll(entities).Schedule(); }
// we run another selection, with only a single prim, making each face a single pick target public int GetClickedFace(Prim prim, int iMouseX, int iMouseY) { //LogFile.WriteLine("picker3dcontroller.getclickedface " + prim + " " + iMouseX + " " + iMouseY); HitTarget hittarget = picker3dmodel.GetClickedHitTarget(new SinglePrimFaceDrawer(prim as Prim), iMouseX, iMouseY); if (hittarget == null || !(hittarget is HitTargetEntityFace)) { return(0); } //LogFile.WriteLine( "result " + hittarget.ToString() ); return((hittarget as HitTargetEntityFace).FaceNumber); }
private bool ValidateTargets(List <HitTarget> targets, SelfTankNode tank, BattleNode battle) { for (int i = 0; i < targets.Count; i++) { HitTarget target = targets[i]; if (this.ValidateTarget(target.Entity, tank, battle)) { return(true); } } return(false); }
public void ApplyBaseHitImpact(HitEvent evt, ShaftAimingImpactNode weapon) { List <HitTarget> targets = evt.Targets; int count = targets.Count; float impactForce = weapon.impact.ImpactForce; for (int i = 0; i < count; i++) { HitTarget target = targets[i]; base.PrepareImpactForHitTarget(weapon.Entity, target, impactForce, 1f); } }
public override void Hit(HitTrigger trigger, HitTarget target) { if (trigger.source != null) { var rigidbody = trigger.source.GetComponent <Rigidbody>(); if (rigidbody != null) { var bouncedVelocity = rigidbody.velocity; bouncedVelocity.y = Mathf.Abs(bouncedVelocity.y) + bouncedVelocity.magnitude / 3; rigidbody.velocity = bouncedVelocity; } } }
public void AddTarget(HitTarget target) { // If already existed update it instead int ti = entries.ContainsAt(target); if (ti >= 0) { entries[ti] = target; } else { entries.Enqueue(target); } }
private void PrepareImpactByBaseHitEvent(HitEvent evt, ImpactWeakeningNode weapon) { DamageWeakeningByDistanceComponent damageWeakeningByDistance = weapon.damageWeakeningByDistance; List <HitTarget> targets = evt.Targets; int count = targets.Count; float impactForce = weapon.impact.ImpactForce; for (int i = 0; i < count; i++) { HitTarget target = targets[i]; float hitDistance = target.HitDistance; float impactWeakeningByRange = base.GetImpactWeakeningByRange(hitDistance, damageWeakeningByDistance); base.PrepareImpactForHitTarget(weapon.Entity, target, impactForce, impactWeakeningByRange); } }
public Entity GetClickedEntity(int iMouseX, int iMouseY) { HitTarget hittarget = picker3dmodel.GetClickedHitTarget(iMouseX, iMouseY); if (hittarget != null) { if (hittarget is HitTargetEntity) { // Test.Debug( "selected has reference " + hittarget.iForeignReference.ToString() ); return(((HitTargetEntity)hittarget).entity); } } return(null); }
protected override void Awake() { base.Awake(); cam = GameManager.I.BaseCamera; input = new PlayerInput(); grapplingAbility = GetComponent <GrapplingAbility>(); hitTarget = GetComponent <HitTarget>(); respawnPosition = transform.position; scrap.Value = 0; steam.Value = 2; }
public void PrepareHit(CollectSplashTargetsEvent evt, SplashWeaponNode weapon) { SplashHitData splashHit = evt.SplashHit; List <HitTarget> directTargets = splashHit.DirectTargets; if (directTargets.Count <= 0) { base.ScheduleEvent(new CalculateSplashCenterByStaticHitEvent(splashHit), weapon.Entity); } else { HitTarget target = directTargets.First <HitTarget>(); Entity entity = target.Entity; base.ScheduleEvent(new CalculateSplashCenterByDirectTargetEvent(splashHit, target.LocalHitPoint), entity); } }
//create the corresponding GUI component - BeatTarget - when called public BeatTarget CreateBeatTarget() { BeatTarget newBeat = null; if (m_type == BeatType.Hit) { newBeat = HitTarget.Create(this); m_beattarget = newBeat; } else if (m_type == BeatType.Held) { newBeat = HoldTarget.Create(this); m_beattarget = newBeat; } return(newBeat); }
public void PrepareImpactOnShot(FixedUpdateEvent evt, ImpactNode weapon) { ImpactComponent impact = weapon.impact; DamageWeakeningByDistanceComponent damageWeakeningByDistance = weapon.damageWeakeningByDistance; HitTarget tankHit = weapon.streamHit.TankHit; if (tankHit != null) { float deltaTime = evt.DeltaTime; VulcanImpactEvent eventInstance = new VulcanImpactEvent(); float hitDistance = tankHit.HitDistance; float impactWeakeningByRange = base.GetImpactWeakeningByRange(hitDistance, damageWeakeningByDistance); eventInstance.Force = (((Vector3.Normalize(tankHit.HitDirection) * impact.ImpactForce) * WeaponConstants.WEAPON_FORCE_MULTIPLIER) * deltaTime) * impactWeakeningByRange; eventInstance.LocalHitPoint = tankHit.LocalHitPoint; eventInstance.WeakeningCoeff = impactWeakeningByRange; Entity[] entities = new Entity[] { weapon.Entity, tankHit.Entity }; base.NewEvent(eventInstance).AttachAll(entities).Schedule(); } }
public void ValidateSplashHitTargetByWeaponPoint(ValidateSplashHitPointsEvent evt, SplashWeaponNode weaponHit, ActiveTankNode targetTank, [JoinByTank] SingleNode <TankIncarnationComponent> targetIncarnation, [JoinByTank] WeaponBoundsNode weaponBoundsTarget) { TankCollidersComponent tankColliders = targetTank.tankColliders; BoxCollider boundsCollider = tankColliders.BoundsCollider; float num = weaponBoundsTarget.weaponBounds.WeaponBounds.size.y * 0.5f; Vector3 position = targetTank.mountPoint.MountPoint.position; float radiusOfMinSplashDamage = weaponHit.splashWeapon.RadiusOfMinSplashDamage; SplashHitData splashHit = evt.SplashHit; Vector3 splashCenter = splashHit.SplashCenter; List <HitTarget> splashTargets = splashHit.SplashTargets; List <GameObject> exclusionGameObjectForSplashRaycast = splashHit.ExclusionGameObjectForSplashRaycast; List <GameObject> targetingColliders = tankColliders.TargetingColliders; Vector3 vector5 = targetTank.rigidbody.Rigidbody.position; Vector3 vector6 = vector5 - splashCenter; float num3 = boundsCollider.size.z * 0.25f; Vector3 vector8 = boundsCollider.transform.forward * num3; Vector3 center = boundsCollider.bounds.center; List <Vector3> list5 = new List <Vector3> { position + (boundsCollider.transform.up * num), center, center - vector8, center + vector8, position }; foreach (Vector3 vector12 in list5) { if (this.IsValidSplashPoint(targetTank, vector12, splashCenter, evt, radiusOfMinSplashDamage)) { HitTarget item = new HitTarget { Entity = targetTank.Entity, IncarnationEntity = targetIncarnation.Entity, LocalHitPoint = Vector3.zero, TargetPosition = vector5, HitDirection = vector6.normalized, HitDistance = vector6.magnitude }; splashTargets.Add(item); exclusionGameObjectForSplashRaycast.AddRange(targetingColliders); break; } } }
private void DoInBackground() { while (!_cts.IsCancellationRequested) { T data; try { data = _dataRetriever.TryRetrieveData(); } catch (Exception e) { if (_allException == null) { _allException = e; } else { _allException = new Exception(_allException.Message + "\n======================================\n" + e.Message); } _continuousFailCnt++; if (_continuousFailCnt == 10) { ProductionFailed?.Invoke(_allException); break; } Thread.Sleep(1000); continue; } NewProduct?.Invoke(data); _continuousFailCnt = 0; if (_cts.IsCancellationRequested) { break; } BlockingQueue.Add(data); // blocking method ProductCnt++; if (ProductCnt >= TargetCnt.GetValueOrDefault(int.MaxValue)) { HitTarget?.Invoke(); break; } } }
protected void ApplyImpactByTargetWeakening(Entity weaponDamager, List <HitTarget> targets, float forceVal, float weakeningByTargetPercent) { float num = 1f; float num2 = weakeningByTargetPercent * 0.01f; int count = targets.Count; for (int i = 0; i < count; i++) { HitTarget target = targets[i]; ImpactEvent eventInstance = new ImpactEvent(); Vector3 vector = (Vector3.Normalize(target.HitDirection) * forceVal) * WeaponConstants.WEAPON_FORCE_MULTIPLIER; eventInstance.Force = vector * num; eventInstance.LocalHitPoint = target.LocalHitPoint; eventInstance.WeakeningCoeff = num; num *= num2; Entity[] entities = new Entity[] { weaponDamager, target.Entity }; base.NewEvent(eventInstance).AttachAll(entities).Schedule(); } }
public void InitiateScaleEdit(int mousex, int mousey) { EditingPreliminaries(); HitTarget hittarget = RendererFactory.GetPicker3dModel().GetClickedHitTarget(mousex, mousey); //Test.Debug( "Clicked target type: " + hittarget.TargetType ); // Test.Debug if (hittarget is HitTargetEditHandle) { Test.Debug("It's an edit handle :-O"); // Test.Debug editing3dscale.InitiateHandleEdit(mousex, mousey, (( HitTargetEditHandle)hittarget).axis); } else { Test.Debug("Not an edit handle"); // Test.Debug editing3dscale.InitiateFreeEdit(mousex, mousey); } }
private void UpdateHitData(HitNode weapon, TargetingData targetingData, bool skipTimeoutCheck) { StreamHitConfigComponent streamHitConfig = weapon.streamHitConfig; StreamHitCheckingComponent streamHitChecking = weapon.streamHitChecking; StreamHitComponent streamHit = weapon.streamHit; HitTarget tankHit = GetTankHit(targetingData); DirectionData bestDirection = targetingData.BestDirection; weapon.streamHitChecking.LastCheckTime = UnityTime.time; streamHit.TankHit = tankHit; streamHit.StaticHit = bestDirection.StaticHit; StaticHit staticHit = !streamHitConfig.DetectStaticHit ? null : bestDirection.StaticHit; bool flag = false; bool flag2 = false; if (!this.IsSameTank(tankHit, streamHitChecking.LastSentTankHit)) { flag = true; } else if (skipTimeoutCheck || ((streamHitChecking.LastSendToServerTime + streamHitConfig.SendToServerPeriod) < UnityTime.time)) { if (!IsAlmostEqual(staticHit, streamHitChecking.LastSentStaticHit)) { flag2 = true; } else if (!this.IsAlmostEqual(tankHit, streamHitChecking.LastSentTankHit)) { flag2 = true; } } if (flag) { weapon.Entity.RemoveComponent <StreamHitComponent>(); this.AddStreamHit(weapon.Entity, targetingData, streamHitConfig, streamHitChecking); } else if (flag2) { base.ScheduleEvent(new SelfUpdateStreamHitEvent(tankHit, staticHit), weapon); this.SaveHitSentToServer(streamHitChecking, streamHit); } }