protected override void OnTriggerEnter(Collider trigger) { // Update all the states OnTriggerUpdate(); // Avoid self triggering if (trigger.gameObject != gameObject) { // Avoid non-interactives unless not required if (trigger.gameObject.GetComponent <Interactive>() != null || interactivesOnly == false) { // Update the current state value triggerEntered = true; // Keep track of the current trigger enteredTriggers.Add(trigger); FlyingObject fo = trigger.GetComponent <FlyingObject>(); if (fo != null) { GameManager.instance.HitObject(fo); } } } }
// Token: 0x0600233B RID: 9019 RVA: 0x0040E8B4 File Offset: 0x0040CAB4 public void Update(float deltaTime) { for (int i = this.workingList.Count - 1; i >= 0; i--) { FlyingObject flyingObject = this.workingList[i]; if (flyingObject.bMove) { flyingObject.Update(deltaTime); } else if (flyingObject.foKind != FOKind.CLv1_Arrow) { if (flyingObject.foKind == FOKind.FreeParticle) { this.particleMgr.DeSpawn(flyingObject.SourceObj); flyingObject.SourceObj = null; } else { flyingObject.SourceObj.SetActive(false); } List <FlyingObject> list = this.freeList[(int)flyingObject.foKind]; list.Add(flyingObject); this.workingList.RemoveAt(i); } else { flyingObject.specialDelay += deltaTime; if (flyingObject.specialDelay >= 1.5f) { flyingObject.SourceObj.SetActive(false); List <FlyingObject> list2 = this.freeList[(int)flyingObject.foKind]; list2.Add(flyingObject); this.workingList.RemoveAt(i); } } } }
private void Explode() { Vector2 explosionPos = transform.position; Collider2D[] colliders = Physics2D.OverlapCircleAll(explosionPos, _explosionRadius); foreach (Collider2D hit in colliders) { if (hit.CompareTag(Config.Tags.flyingObject)) { FlyingObject obj = hit.GetComponent <FlyingObject>(); if (obj.FlyingObjType == FlyingObject.FlyingObjectType.Player) { Player player = hit.GetComponent <Player>(); // If player is not indistructable dies if (!player.IsIndistructable()) { player.Destroy(); } // If player is indistructable is affected by explosion force else { Rigidbody2D rb = hit.GetComponent <Rigidbody2D>(); AddExplosionForce2D(rb, _explosionPower / 2, explosionPos, _explosionRadius); } } else { Rigidbody2D rb = hit.GetComponent <Rigidbody2D>(); AddExplosionForce2D(rb, _explosionPower, explosionPos, _explosionRadius); } } } }
void Update() { RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), out hit, maxDis)) { if (hit.collider.tag == "Back") { maxDis -= 0.7f; } } if (maxDis <= 0.5f) { rd = this.GetComponent <Rigidbody>(); rd.useGravity = false; if (!FOScript) { FOScript = gameObject.AddComponent <FlyingObject>(); FOScript.swingPow = 0.05f; FOScript.Range = 4; } } // 当たった時の処理 && 武器を持っていた場合 if (hitFlg && Weapon) { // 弾を追加する Weapon.GetComponent <GunController>().remAmmo += bulletNum; //Weapon.GetComponent<GunController>().Ammo += bulletNum; // 自分を削除 Destroy(this.gameObject); } }
protected override bool TryCastShot() { bool flag10 = false; this.TargetsAoE.Clear(); this.UpdateTargets(); int shotsPerBurst = this.ShotsPerBurst; bool flag2 = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1; if (flag2) { this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1); } for (int i = 0; i < this.TargetsAoE.Count; i++) { bool?flag3 = this.TryLaunchProjectile(this.verbProps.defaultProjectile, this.TargetsAoE[i]); bool hasValue = flag3.HasValue; if (hasValue) { bool flag4 = flag3 == true; if (flag4) { flag10 = true; } bool flag5 = flag3 == false; if (flag5) { flag10 = false; } } } CellRect cellRect = CellRect.CenteredOn(this.currentTarget.Cell, 1); Map map = caster.Map; cellRect.ClipInsideMap(map); IntVec3 centerCell = cellRect.CenterCell; Thing summonableThing = new Thing(); FlyingObject summonablePawn = new FlyingObject(); Pawn victim = null; //dinfo.SetAmount(10); //dinfo.SetWeaponHediff(TorannMagicDefOf.TM_GrapplingHook); bool pflag = true; summonableThing = centerCell.GetFirstPawn(map); if (summonableThing == null) { pflag = false; //miss } else { pVect = summonableThing.TrueCenter(); pVect.x = base.caster.TrueCenter().x; pVect.z = base.caster.TrueCenter().z; pVect.y = 0f; victim = summonableThing as Pawn; if (victim != null) { if (!victim.IsColonist && !victim.IsPrisoner && !victim.Faction.HostileTo(this.CasterPawn.Faction) && victim.Faction != null && victim.RaceProps.Humanlike) { Faction faction = victim.Faction; faction.TrySetRelationKind(this.CasterPawn.Faction, FactionRelationKind.Ally, false, null); } } } bool result; bool arg_40_0; if (this.currentTarget != null && base.caster != null) { IntVec3 arg_29_0 = this.currentTarget.Cell; arg_40_0 = this.caster.Position.IsValid; } else { arg_40_0 = false; } bool flag = arg_40_0; if (flag) { if (summonableThing != null) { if (pflag) { DamageInfo dinfo2 = new DamageInfo(DamageDefOf.Stun, 10, 10, -1, this.CasterPawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown, victim); if (!victim.RaceProps.Humanlike || victim.Faction == this.CasterPawn.Faction) { summonablePawn = (FlyingObject)GenSpawn.Spawn(ThingDef.Named("TM_SummonedPawn"), summonableThing.Position, summonableThing.Map); summonablePawn.impactDamage = dinfo2; summonablePawn.Launch(base.caster, new LocalTargetInfo(pVect.ToIntVec3()), summonableThing); } else if (victim.RaceProps.Humanlike && victim.Faction != this.CasterPawn.Faction && Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, victim, true))) { summonablePawn = (FlyingObject)GenSpawn.Spawn(ThingDef.Named("TM_SummonedPawn"), summonableThing.Position, summonableThing.Map); summonablePawn.impactDamage = dinfo2; summonablePawn.Launch(base.caster, new LocalTargetInfo(pVect.ToIntVec3()), summonableThing); } else { MoteMaker.ThrowText(victim.DrawPos, victim.Map, "TM_ResistedSpell".Translate(), -1); } } else { //miss } result = true; } } else { Log.Warning("failed to TryCastShot"); } //this.burstShotsLeft = 0; //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60; this.PostCastShot(flag10, out flag10); return(flag); }
public ManuallyMovingBehavior(FlyingObject source) { this.source = source; }
public static int RequestID(FlyingObject obj) { return(RequestID(obj.gameObject)); }
// Use this for initialization void Start() { anim = GetComponent <Animation>(); flyingObjectScript = parentObject.GetComponent <FlyingObject>(); CanShoot = true; }
public MovingRandomlyBehavior(FlyingObject flyingObject) { this.flyingObject = flyingObject; }