using UnityEngine; using System.Collections; using GameKitController.Audio; public class slowDownTarget : projectileSystem { [Header ("Main Settings")] [Space] public string characterStateAffectedName = "Character Freeze Velocity"; public float slowDownDuration = 6; [Range (0, 1)] public float slowValue = 0.2f; public bool useSlowObjectColor = true; public Color slowObjectsColor = Color.blue; void OnTriggerEnter (Collider col) { if (canActivateEffect (col)) { if (currentProjectileInfo.impactAudioElement != null) { currentProjectileInfo.impactAudioElement.audioSource = GetComponent (); AudioPlayer.PlayOneShot (currentProjectileInfo.impactAudioElement, gameObject); } setProjectileUsedState (true); objectToDamage = col.GetComponent ().gameObject; characterDamageReceiver currentCharacterDamageReceiver = objectToDamage.GetComponent (); if (currentCharacterDamageReceiver != null) { objectToDamage = currentCharacterDamageReceiver.character; } slowObject currentSlowObject = objectToDamage.GetComponent (); if (currentSlowObject == null) { playerComponentsManager mainPlayerComponentsManager = objectToDamage.GetComponent (); if (mainPlayerComponentsManager != null) { characterPropertiesSystem currentCharacterPropertiesSystem = mainPlayerComponentsManager.getCharacterPropertiesSystem (); if (currentCharacterPropertiesSystem != null) { characterStateAffectedInfo currentCharacterStateAffectedInfo = currentCharacterPropertiesSystem.getCharacterStateAffectedInfoByName (characterStateAffectedName); if (currentCharacterStateAffectedInfo != null) { currentSlowObject = currentCharacterStateAffectedInfo as slowObject; } } } } if (currentSlowObject != null) { slowObjectsColor currentSlowObjectsColor = currentSlowObject.getObjectToCallFunction ().GetComponent (); if (currentSlowObjectsColor == null) { currentSlowObjectsColor = currentSlowObject.getObjectToCallFunction ().AddComponent (); } if (currentSlowObjectsColor != null) { currentSlowObjectsColor.startSlowObject (useSlowObjectColor, slowObjectsColor, slowValue, slowDownDuration, currentSlowObject); } } disableBullet (currentProjectileInfo.impactDisableTimer); } } public override void resetProjectile () { base.resetProjectile (); } }