Beispiel #1
0
        // ********************************
        // Device breaks
        // ********************************
        protected virtual void Break(string damageType = "BrokenElectronicsSpark")
        {
            if (this.Health > 0.0f && this.Broken)
            {
                this.Health = 0.0f;
            }

            if (this.Broken)
            {
                return;
            }

            this.Activated = false;
            this.Broken    = true;

            if (Array.Exists(ValidParticleEffects, element => element == damageType))
            {
                ModAPI.CreateParticleEffect(damageType, this.transform.position);
            }
            else
            {
                ModAPI.CreateParticleEffect("BrokenElectronicsSpark", this.transform.position);
            }

            this.UpdateActivation();
        }
    void Update()
    {
        //status
        if (this.droneHealth < 0 || this.selfDestruct)
        {
            while (debrisAmount < maxDebris)
            {
                for (debrisAmount = 0; debrisAmount < maxDebris; debrisAmount++)
                {
                    debri[debrisAmount] = ModAPI.CreatePhysicalObject("Debris", debrisComp.debrisSprites[UnityEngine.Random.Range(0, debrisComp.debrisSprites.Length)]);
                    debri[debrisAmount].transform.position = transform.position;
                    randomDirection = UnityEngine.Random.Range(-5, 5);
                    debri[debrisAmount].GetComponent <PhysicalBehaviour>().rigidbody.AddForce(new Vector2(randomDirection, randomDirection) * debrisForce);
                }
            }

            ModAPI.CreateParticleEffect("Explosion", transform.position);
            Destroy(gameObject);
            selfDestruct = false;
        }
    }
Beispiel #3
0
 // ********************************
 // Device hit by EMP
 // ********************************
 protected virtual void OnEMPHit()
 {
     ModAPI.CreateParticleEffect("BigZap", this.transform.position);
     this.Break("FuseBlown");
 }