void OnTriggerStay(Collider coll) { if (coll.gameObject.GetComponent <AFPC_PlayerMovement> () && text != null) { _afpcPlayer = coll.gameObject.GetComponent <AFPC_PlayerMovement> (); _spawnMngr = _afpcPlayer.GetComponent <AFPC_SpawnManager> (); if (_afpcPlayer.playerType == AFPC_PlayerMovement.PlayerType.rigidBodyPlayer && !_spawnMngr.HasDied) { text.gameObject.SetActive(true); text.text = desiredText; } else if (_afpcPlayer.playerType == AFPC_PlayerMovement.PlayerType.rigidBodyPlayer && _spawnMngr.HasDied) { text.gameObject.SetActive(false); } } }
// Use this for initialization void Start() { if (GetComponent <AFPC_SpawnManager> ()) { spawnManager = GetComponent <AFPC_SpawnManager> (); } afpcPlayer = GetComponent <AFPC_PlayerMovement> (); if (afpcPlayer.playerType == AFPC_PlayerMovement.PlayerType.rigidBodyPlayer) { if (kickBack != null) { kickBackAnimator = kickBack.GetComponent <Animator> (); healthDecreaseAnimHashId = Animator.StringToHash("DoHealthDecreaseKickBack"); } health = Mathf.Clamp(health, minHealth, maxHealth); // To make sure user can't enter health value which is not in range if (healthDecreaseEffect != null) { startingColor = healthDecreaseEffect.color; healthDecreaseEffect.gameObject.SetActive(false); } if (!GetComponent <AudioSource> () && useHealthDecreaseAudioEffects) { gameObject.AddComponent <AudioSource> (); audioSource = GetComponent <AudioSource> (); } else if (useHealthDecreaseAudioEffects && GetComponent <AudioSource>()) { audioSource = GetComponent <AudioSource> (); } if (useHealthDecreaseAudioEffects) { audioSource.volume = audioVolume; audioSource.playOnAwake = false; } } else if (afpcPlayer.playerType == AFPC_PlayerMovement.PlayerType.spectator) { if (healthMaster != null) { healthMaster.gameObject.SetActive(false); } } }
// Use this for initialization void Start() { cameraOriginalRotation = transform.rotation; cameraStartPos = transform.localPosition; ClimbBobCurveTime = climbBobCurve [climbBobCurve.length - 1].time; if (afpcPlayer == null) { afpcPlayer = GameObject.FindObjectOfType <AFPC_PlayerMovement> (); } if (afpcPlayer != null) { spawnManager = afpcPlayer.gameObject.GetComponent <AFPC_SpawnManager> (); _audioSrc = afpcPlayer.GetComponent <AudioSource> (); } if (jumpkickBack == null) { jumpkickBack = transform.parent.gameObject; } jumpKickBackAnimationController = jumpkickBack.GetComponent <Animator> (); jumpKickBackTriggerHashId = Animator.StringToHash("DoJumpKickBack"); }
public override void OnInspectorGUI() { AFPC_SpawnManager spawnManager = (AFPC_SpawnManager)target; EditorGUILayout.BeginVertical("NotificationBackground"); spawnManager.dieDropForce = EditorGUILayout.FloatField("Force To Exert On Head On Dying: ", spawnManager.dieDropForce); spawnManager.timeToApplyForce = EditorGUILayout.FloatField("Time To Apply Die Drop Force on Dying: ", spawnManager.timeToApplyForce); spawnManager.fadePanel = (Image)EditorGUILayout.ObjectField("Fade Panel Image: ", spawnManager.fadePanel, typeof(Image), true); spawnManager.timeToRespawn = EditorGUILayout.FloatField("Time in seconds to respawn: ", spawnManager.timeToRespawn); spawnManager.timeToFadeIn = EditorGUILayout.FloatField("Time in seconds to FadeIn FadePanel: ", spawnManager.timeToFadeIn); spawnManager.timeToFadeOut = EditorGUILayout.FloatField("Time in seconds to FadeOut FadePanel: ", spawnManager.timeToFadeOut); spawnManager.hasDroppablesOnDie = EditorGUILayout.Toggle("Drop Gameobjects on Die: ", spawnManager.hasDroppablesOnDie); if (spawnManager.hasDroppablesOnDie) { var serializedObj = new SerializedObject(target); var property = serializedObj.FindProperty("Droppables"); serializedObj.Update(); EditorGUILayout.PropertyField(property, true); serializedObj.ApplyModifiedProperties(); } spawnManager.spawnAtDiePoint = EditorGUILayout.Toggle("Spawn At Die Position: ", spawnManager.spawnAtDiePoint); if (!spawnManager.spawnAtDiePoint) { var serializedObj = new SerializedObject(target); var property = serializedObj.FindProperty("spawnPoints"); serializedObj.Update(); EditorGUILayout.PropertyField(property, true); serializedObj.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(spawnManager); } }