// Note: Static utility members specific to a feature colocated with the feature. public override void Destroy(DestroyType typ, Outfit referenceOutfit) { Observers.SendDestroy(this, typ, referenceOutfit); // Don't worry about unknown assessories/components added improperly to the outfit. If that is // important to the user, the user can create a bake extension to handle it. for (int i = 0; i < m_Accessories.Count; i++) { if (m_Accessories[i]) { m_Accessories[i].RemoveObserver(this); m_Accessories[i].Destroy(typ); } } Reset(); if (typ == DestroyType.GameObject) { gameObject.SafeDestroy(); } else { this.SafeDestroy(); } }
public override bool Destroy(DestroyType type = null) { AmmoType gun = new ATShrapnel(); gun.FireBullet(new Vec2(x, y)); //Level.Remove(gun); return(base.Destroy(type)); }
protected override void OnDestroyLocal(DestroyType typ) { if (m_PriorityMounter) { PriorityMounter.OnAccessoryDestroy(this, typ); } m_Mounters.SendAccessoryDestroy(this, typ); }
private void OnKill(DestroyType type = null) { if (type is DTFall) { SFX.Play(Mod.GetPath <EdoMod>("SFX\\wilhelm")); } //if (type is DTShot) SFX.Play(); _OnKill(type); }
protected override bool OnDestroy(DestroyType type = null) { if (type is DTIncinerate) { Level.Remove((Thing)this); Level.Add((Thing)SmallSmoke.New(this.x, this.y)); } return(false); }
/// <summary> /// Send the <see cref="IOutfitObserver.OnDestroy"/> event. /// </summary> /// <param name="sender">The outfit being destroyed.</param> /// <param name="referenceOutfit"> /// The outfit that the sender is derived from. (E.g. Was instanced from.) /// Or null if the sender has no applicable reference. (Only applicable to the /// 'bake' type.) /// </param> public void SendDestroy(Outfit sender, DestroyType typ, Outfit referenceOutfit) { for (int i = 0; i < Count; i++) { if (this[i] != null) { this[i].OnDestroy(sender, typ, referenceOutfit); } } }
void IAccessoryObserver.OnDestroy(Accessory sender, DestroyType typ) { if (typ == DestroyType.Bake) { Debug.LogError("Force release of accessory: Unexpected bake: " + sender.name, m_Owner); } UnlinkAccessory(sender); }
/// <summary> /// Send the <see cref="IAccessoryObserver.OnDestroy"/> event to all observers. /// </summary> /// <param name="sender">The accessory sending the event.</param> /// <param name="typ">The type of destroy event underway.</param> public void SendDestroy(Accessory sender, DestroyType typ) { for (int i = 0; i < Count; i++) { if (this[i] != null) { this[i].OnDestroy(sender, typ); } } }
/// <summary> /// Send the <see cref="IAccessoryMounter.OnAccessoryDestroy"/> event to all mounters. /// </summary> /// <param name="sender">The accessory to be destroyed.</param> /// <param name="typ">The accessory destroy type.</param> public void SendAccessoryDestroy(Accessory sender, DestroyType typ) { for (int i = 0; i < Count; i++) { var mounter = this[i]; if (mounter != null) { mounter.OnAccessoryDestroy(sender, typ); } } }
void IAccessoryObserver.OnDestroy(Accessory sender, DestroyType typ) { if (typ == DestroyType.Bake) { Debug.LogError("Released accessory: Accessory baked, but not by this outfit: " + sender.name, this); } UnlinkAccessory(sender); SendUnmount(sender); }
protected override bool OnDestroy(DestroyType type = null) { if (this.sequence != null && this.sequence.isValid) { this.sequence.Finished(); if (ChallengeLevel.running) { ++ChallengeLevel.goodiesGot; } } return(base.OnDestroy(type)); }
protected override bool OnDestroy(DestroyType type = null) { if (this.isServerForObject) { for (int index = 0; index < this._numFlames; ++index) { Level.Add((Thing)SmallFire.New(this.x - this.hSpeed, this.y - this.vSpeed, Rando.Float(6f) - 3f, Rando.Float(6f) - 3f, firedFrom: ((Thing)this))); } } SFX.Play("flameExplode", 0.9f, Rando.Float(0.2f) - 0.1f); Level.Remove((Thing)this); return(true); }
public int GetBaseScore(DestroyType type, int faceNumber) { switch (type) { case DestroyType.Underwear: return(GameSettings.baseScoreForItems); case DestroyType.Kiss: return(GameSettings.baseScoreForEachFaces * faceNumber); default: return(0); } }
public int UpdateScore(int score, DestroyType dt, int multCount = 1) { switch (dt) { case DestroyType.OnClick: return(score += multCount == 1 ? IncScoreOnClick : IncScoreOnClick *multCount *CoefficOnMultClick); case DestroyType.OnOut: return(score += IncScoreOnOut * multCount); default: return(score); } }
public sealed override void Destroy(DestroyType typ) { OnDestroyLocal(typ); m_Observers.SendDestroy(this, typ); if (typ == DestroyType.GameObject) { gameObject.SafeDestroy(); } else { this.SafeDestroy(); } }
void IOutfitObserver.OnDestroy(Outfit sender, DestroyType typ, Outfit referenceOutfit) { if (m_Outfit == sender) { Debug.LogError("Outfit destroyed while owned by body. Soft reset performed.", this); SoftReset(); } else { // Overkill? Debug.LogError("Internal error: Body is observing external outfit: " + sender.name, this); sender.RemoveObserver(this); } }
void IOutfitObserver.OnDestroy(Outfit sender, DestroyType typ, Outfit referenceOutfit) { if (m_Outfit && m_Outfit == sender) { Debug.LogError("Outfit destroyed while owned by body. Forced an unlink.", this); sender.RemoveObserver(this); SetOutfit(null, typ == DestroyType.Bake); } else { // Overkill? Debug.LogError("Internal error: Body is observing external outfit: " + sender.name, this); sender.RemoveObserver(this); } }
/// <summary> /// Called by parent class for drawing specific variables at top. /// Parent class should automatically check for when it is dirty. /// </summary> protected override void DrawChildInspector() { destroyType = (DestroyType)EditorGUILayout.EnumPopup("Destroy Type", destroyType); switch (destroyType) { case DestroyType.Target: DrawDestroyType_Target(); break; case DestroyType.Self: DrawDestroyType_Self(); break; case DestroyType.Triggerer: DrawDestroyType_Triggerer(); break; } }
protected override bool OnDestroy(DestroyType type = null) { if (this._stuck && (double)this._stickTime > 0.980000019073486) { return(false); } if (type is DTFade) { DartShell dartShell = new DartShell(this.x, this.y, Rando.Float(0.1f) * -this._sprite.flipMultH, this._sprite.flipH); dartShell.angle = this.angle; Level.Add((Thing)dartShell); dartShell.hSpeed = (float)((0.5 + (double)Rando.Float(0.3f)) * -(double)this._sprite.flipMultH); Level.Remove((Thing)this); return(true); } if (this._stuck && (double)this._stickTime > 0.100000001490116) { this._stickTime = 0.1f; } return(false); }
protected override bool OnDestroy(DestroyType type = null) { if (!base.isServerForObject) { return(false); } ATRCShrapnel shrap = new ATRCShrapnel(); shrap.MakeNetEffect(this.position, false); List <Bullet> firedBullets = new List <Bullet>(); for (int i = 0; i < 20; i++) { float dir = (float)i * 18f - 5f + Rando.Float(10f); shrap = new ATRCShrapnel(); shrap.range = 55f + Rando.Float(14f); Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(dir)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(dir)) * 6.0), shrap, dir, null, false, -1f, false, true); bullet.firedFrom = this; firedBullets.Add(bullet); Level.Add(bullet); } if (Network.isActive) { NMFireGun gunEvent = new NMFireGun(null, firedBullets, 0, false, 4, false); Send.Message(gunEvent, NetMessagePriority.ReliableOrdered, null); firedBullets.Clear(); } Level.Remove(this); FollowCam cam = Level.current.camera as FollowCam; if (cam != null) { cam.Remove(this); } if (Recorder.currentRecording != null) { Recorder.currentRecording.LogBonus(); } return(true); }
public override void Activate() { if (!(Level.current is GameLevel) || (int)DuckNetwork.levelIndex != (int)this._levelIndex) { return; } Profile profile = DuckNetwork.profiles[(int)this.index]; if (profile.duck == null) { return; } DestroyType type = !this.crush ? (DestroyType) new DTImpact((Thing)null) : (DestroyType) new DTCrush((PhysicsObject)null); profile.duck.isKillMessage = true; profile.duck.Kill(type); if (!this.cook) { profile.duck.GoRagdoll(); } profile.duck.isKillMessage = false; Thing.Fondle((Thing)profile.duck, this.connection); if (profile.duck._ragdollInstance != null) { Thing.Fondle((Thing)profile.duck._ragdollInstance, this.connection); } if (profile.duck._trappedInstance != null) { Thing.Fondle((Thing)profile.duck._trappedInstance, this.connection); } if (profile.duck._cookedInstance == null) { return; } Thing.Fondle((Thing)profile.duck._cookedInstance, this.connection); }
public override void OnAccessoryDestroy(Accessory accessory, DestroyType type) { RemoveMountState(accessory); }
protected override bool OnDestroy(DestroyType type = null) { return(false); }
public virtual void OnAccessoryDestroy(Accessory accessory, DestroyType type) { // Do nothing. // For most scriptable object mounters the main purpose for this is state cleanup of in-progress mounts, // so likelihood of use is similar to CancelMount. }
//////////////////////////////////////////////////////////////////////////////////////////// // HACK: Unity 5.3.1: Workaround for Mono's optional parameter key duplication bug. /// <summary> /// Destroy the accessory. /// </summary> /// <remarks> /// <para> /// This is the best way of destroying an accessory since it allows the accessory to notify its observers /// and any other associated components so they can properly respond. /// </para> /// <para><strong>Baking</strong></para> /// <para> /// What happens to an accessory when it is baked is implementation specific. The accessory may bake its /// skinned meshes, remove colliders, etc. Baking most often happens when the outfit the accessory is /// attached to is baked. /// </para> /// <para> /// It is a valid behavior for an accessory to reject a bake and simply auto-release as a result of the /// request. This supports situations where an accessory is semi-independant. E.g. A fairy that is /// fluttering around the outfit's head. A bake (a.k.a death) of the outfit results in the fairy being freed. /// </para> /// </remarks> /// <param name="typ">The type of destruction.</param> /// <param name="prepareOnly"> /// If true, the component will only prepare for destruction, but won't actually destroy itself. /// </param> public void Destroy(DestroyType typ) { Destroy(typ, false); }
/// <summary> /// Destroy the accessory. /// </summary> /// <remarks> /// <para> /// This is the best way of destroying an accessory since it allows the accessory to notify its observers /// and any other associated components so they can properly respond. /// </para> /// <para> /// If <paramref name="prepareOnly"/> is false the component will destroy itself, so the client only needs /// to call this method then dispose of its references. If <paramref name="prepareOnly"/> is true, it is /// the responsiblity of the caller to properly destroy the component or its GameObject. The primary use /// case for <paramref name="prepareOnly"/> is when performing operations in the editor that require /// Undo behavior. /// </para> /// <para><strong>Baking</strong></para> /// <para> /// What happens to an accessory when it is baked is implementation specific. The accessory may bake its /// skinned meshes, remove colliders, etc. Baking most often happens when the outfit the accessory is /// attached to is baked. /// </para> /// <para> /// It is a valid behavior for an accessory to reject a bake and simply auto-release as a result of the /// request. This supports situations where an accessory is semi-independant. E.g. A fairy that is /// fluttering around the outfit's head. A bake (a.k.a death) of the outfit results in the fairy being freed. /// </para> /// </remarks> /// <param name="typ">The type of destruction.</param> /// <param name="prepareOnly"> /// If true, the component will only prepare for destruction, but won't actually destroy itself. /// </param> public abstract void Destroy(DestroyType typ, bool prepareOnly);
protected abstract void OnDestroy(Outfit sender, DestroyType typ, Outfit referenceOutfit);
void IOutfitObserver.OnDestroy(Outfit sender, DestroyType typ, Outfit referenceOutfit) { OnDestroy(sender, typ, referenceOutfit); }
/// <summary> /// Called on the destroy event before any other action is taken. /// </summary> /// <param name="typ"></param> protected virtual void OnDestroyLocal(DestroyType typ) { // Do nothing. }
private void _OnKill(DestroyType type = null) { Console.WriteLine("This is here as a placeholder."); }