public void Clear() { /*halmeida - no need to clear the particle controller because it will be done when clearing the * animator of the obstacle. Instead we just point away from it.*/ /*if( particleController != null ) * { * particleController.Clear(); * particleController = null; * }*/ particleController = null; if (debrisAnimators != null) { for (int i = 0; i < debrisAnimators.Length; i++) { debrisAnimators[i].Clear(); debrisAnimators[i] = null; Destroy(debrisObjects[i]); debrisObjects[i] = null; } debrisAnimators = null; debrisObjects = null; } obstacleCollider = null; if (obstacleAnimator != null) { obstacleAnimator.Clear(); obstacleAnimator = null; } ClearAllSoundsFromResources(); ClearAllSoundsFromAudioCenter(); }
protected override void ClearItemAnimator() { if (areaLockAnimator != null) { areaLockAnimator.Clear(); areaLockAnimator = null; } }
public override void Clear() { base.Clear(); projectileCollider = null; if (projectileAnimator != null) { projectileAnimator.Clear(); projectileAnimator = null; } accumulatedEffect = 0f; }
void Awake() { obstacleCollider = GetComponent <Collider2D>(); obstacleAnimator = GetComponent <ShortLifeAnimator>(); maxHP = (obstacleHP > 0f) ? obstacleHP : 1f; currentHP = maxHP; destroyed = false; over = false; damageWaveLength = (damageWaveLength < 0f) ? 0f : damageWaveLength; debrisDensityDamage = (debrisDensityDamage < 0f) ? 0f : debrisDensityDamage; debrisDensityDestruction = (debrisDensityDestruction < 0f) ? 0f : debrisDensityDestruction; waveColorDamage = Color.white; waveColorRecovery = new Color(0.8f, 1f, 0.8f, 1f); waveFrontLimit = 3f * damageWaveLength; waveLengths = new Vector4(damageWaveLength, damageWaveLength / 4f, damageWaveLength / 8f, damageWaveLength / 12f); waveAlphas = new Vector4(1f, 0.7f, 0.45f, 0.2f); waveSpeed = 10f * damageWaveLength; debrisSlotDamage = (debrisDensityDamage > 0f) ? (1f / debrisDensityDamage) : 0f; debrisSlotDestruction = (debrisDensityDestruction > 0f) ? (1f / debrisDensityDestruction) : 0f; debrisObjects = null; debrisAnimators = null; debrisDepth = DisplayDepthManager.ELEMENT_TO_ELEMENT_OFFSET / BaseAnimator.MAX_ANIMATORS_WITHIN_LAYER; colliderWidth = 0f; colliderHeight = 0f; if (obstacleCollider != null) { colliderWidth = obstacleCollider.bounds.size.x; colliderHeight = obstacleCollider.bounds.size.y; } debrisExtraDelay = (extraDebrisDelay > 0f) ? extraDebrisDelay : 0f; debrisExtraElapsed = 0f; particleController = GetComponent <VFXParticleController>(); audioSourceDamage = null; damageInSounds = null; damageInSoundIDs = null; destructionSounds = null; destructionSoundIDs = null; /*halmeida - the AudioCenter is a plugin for reducing latency of sounds in Android devices. It also supports the sound * playback outside of the Android environment, but that support is really poor, with a single AudioSource. Because * of that, I don't wanna use it unless we are within the android environment.*/ #if !UNITY_ANDROID || UNITY_EDITOR AddAudioSources(); LoadAllSoundsFromResources(); #else LoadAllSoundsIntoAudioCenter(); #endif }
protected override void Awake() { base.Awake(); triggerSourceComponent = null; triggerComponents = null; triggeringComponents = null; projectileCollider = GetComponent <Collider2D>(); active = true; over = false; direction = Vector2.zero; speed = 0f; vectorSpeed = Vector2.zero; acceleration = 0f; maxSpeed = 0f; effectCode = EFFECT_CODE_INVALID; effectIntensity = 0f; destructionLevel = ObstacleController.CONSTRUCTION_LEVEL_INVALID; activeDuration = 0f; activeElapsed = 0f; projectileAnimator = GetComponent <ShortLifeAnimator>(); accumulatedEffect = 0f; }
protected override void Awake() { areaLockAnimator = null; /*halmeida - set the animator to null because the Awake of the base class will call Clear(), and * the redefinition of Clear() in this class asks if the animator is null.*/ base.Awake(); graph = null; cost = 0; paid = 0; payment = 0; paymentInitialValue = PAYMENT_INITIAL_VALUE; paymentChangeFactor = PAYMENT_CHANGE_FACTOR_1; paymentsToChange = PAYMENTS_TO_CHANGE; paymentsDone = 0; paymentDuration = PAYMENT_DURATION; paymentElapsed = 0f; transactionBoxManager = TransactionBoxManager.Instance; transactionAgent = null; transactionCreated = false; runningMiddleWave = false; continuousEffect = true; }
protected override void ExtractItemAnimator() { areaLockAnimator = GetComponent <ShortLifeAnimator>(); }