Browse Source

fixed bugs

master
Sagittaeri 7 years ago
parent
commit
3d584894ec
6 changed files with 46 additions and 26 deletions
  1. +26
    -17
      IronToad_UnityProject/Assets/Scripts/Catapult.cs
  2. +7
    -4
      IronToad_UnityProject/Assets/Scripts/LightBeam.cs
  3. +8
    -2
      IronToad_UnityProject/Assets/Scripts/PlayerController.cs
  4. +5
    -3
      IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs
  5. BIN
      IronToad_UnityProject/Assets/_Scenes/GreyBox_Prototype.unity
  6. BIN
      IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity

+ 26
- 17
IronToad_UnityProject/Assets/Scripts/Catapult.cs View File

@ -23,21 +23,25 @@ public class Catapult : MonoBehaviour
private BGCcCursorObjectTranslate splineObjectTranslate;
private Vector3 originalScale;
private MeshRenderer meshRenderer;
private ParticleSystem particleSystem;
private Collider boulderCollider;
private ParticleSystem boulderParticleSystem;
void Start ()
{
splineCursor = splineCurve.GetComponent<BGCcCursor>();
splineObjectTranslate = splineCurve.GetComponent<BGCcCursorObjectTranslate>();
meshRenderer = splineObjectTranslate.ObjectToManipulate.GetComponent<MeshRenderer>();
particleSystem = splineObjectTranslate.ObjectToManipulate.GetComponentInChildren<ParticleSystem>();
boulderCollider = splineObjectTranslate.ObjectToManipulate.GetComponent<Collider>();
boulderParticleSystem = splineObjectTranslate.ObjectToManipulate.GetComponentInChildren<ParticleSystem>();
meshRenderer.enabled = false;
particleSystem.Stop();
boulderCollider.enabled = false;
boulderParticleSystem.Stop();
originalScale = splineCurve.transform.parent.localScale;
NotificationServer.register("statechange Searchlight", searchlightStateChanged);
NotificationServer.register("BoulderHit", boulderHit);
NotificationServer.register("restart scene", boulderHit);
}
void Update()
@ -72,26 +76,31 @@ public class Catapult : MonoBehaviour
isLaunching = false;
return;
}
particleSystem.Stop();
meshRenderer.enabled = true;
boulderParticleSystem.Stop();
splineCursor.DistanceRatio = 0f;
splineCurve.transform.parent.position = player.position
+ Vector3.right * Random.Range(-randomFactor, randomFactor)
+ Vector3.forward * Random.Range(-randomFactor, randomFactor);
splineCurve.transform.parent.localEulerAngles = Vector3.up * Random.Range(0f, 360f);
splineCurve.transform.parent.localScale = new Vector3(Random.Range(minScale * originalScale.x, maxScale * originalScale.x), originalScale.y, originalScale.z);
particleSystem.Play();
LeanTween.value(splineObjectTranslate.ObjectToManipulate.gameObject, 0f, 1f, splineCursor.Math.GetDistance() / speed)
.setEase(animationCurve)
.setOnUpdate((float val)=>{
splineCursor.DistanceRatio = val;
}).setOnComplete(()=>{
particleSystem.Stop();
// splineCursor.DistanceRatio = 0f;
isLaunching = false;
meshRenderer.enabled = false;
launchBoulder();
});
LeanTween.delayedCall(splineObjectTranslate.ObjectToManipulate.gameObject, 0.1f, ()=>{
boulderParticleSystem.Play();
meshRenderer.enabled = true;
boulderCollider.enabled = true;
LeanTween.value(splineObjectTranslate.ObjectToManipulate.gameObject, 0f, 1f, splineCursor.Math.GetDistance() / speed)
.setEase(animationCurve)
.setOnUpdate((float val)=>{
splineCursor.DistanceRatio = val;
}).setOnComplete(()=>{
boulderParticleSystem.Stop();
isLaunching = false;
meshRenderer.enabled = false;
LeanTween.delayedCall(splineObjectTranslate.ObjectToManipulate.gameObject, 0.5f, ()=>{
boulderCollider.enabled = false;
launchBoulder();
});
});
});
});
}
}

+ 7
- 4
IronToad_UnityProject/Assets/Scripts/LightBeam.cs View File

@ -11,6 +11,7 @@ public class LightBeam : MonoBehaviour {
void Start () {
NotificationServer.register("statechange Searchlight", toggleState);
NotificationServer.register("switch off", switchOff);
NotificationServer.register("restart scene", resetState);
}
// Update is called once per frame
@ -18,16 +19,18 @@ public class LightBeam : MonoBehaviour {
Vector3 lookAtPos = target.position;
lookAtPos.y = lightBeam.position.y;
lightBeam.LookAt(target);
}
private void toggleState() {
GetComponent<Animator>().SetBool("isSeen", (Searchlight.state == Searchlight.SearchState.Chasing));
}
private void resetState() {
lightBeam.gameObject.SetActive(true);
target.gameObject.SetActive(true);
GetComponent<Animator>().SetBool("isSeen", false);
}
private void switchOff() {
lightBeam.gameObject.SetActive(false);
target.gameObject.SetActive(false);

+ 8
- 2
IronToad_UnityProject/Assets/Scripts/PlayerController.cs View File

@ -30,7 +30,7 @@ public class PlayerController : MonoBehaviour {
instance = this;
startPoint = boat.transform.position;
isLocked = true;
}
// Update is called once per frame
@ -73,7 +73,13 @@ public class PlayerController : MonoBehaviour {
setLife(life - 1);
lastDamageTime = Time.time;
if (life == 0)
NotificationServer.notify("show GameOverPanel");
{
NotificationServer.notify("fade bgm");
NotificationServer.notify("play sfx", "shipSpotted:0.5");
NotificationServer.notify("play sfx", "sinkingShip:0.75");
NotificationServer.notify("show GameOverPanel");
NotificationServer.notify("hide GameUI");
}
}
}

+ 5
- 3
IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs View File

@ -6,6 +6,7 @@ using UnityStandardAssets.CinematicEffects;
public class ScreenEffects : MonoBehaviour
{
public DepthOfField depthOfField;
public float strength = 0f;
private float originalNearRadius;
private float originalFarRadius;
@ -28,11 +29,12 @@ public class ScreenEffects : MonoBehaviour
float startNear = depthOfField.focus.nearBlurRadius;
float startFar = depthOfField.focus.farBlurRadius;
DepthOfField.FocusSettings focus = depthOfField.focus;
LeanTween.value(gameObject, 1f, 0f, 0.5f).setEaseInOutQuad().setOnUpdate((float val)=>{
LeanTween.value(gameObject, 1f, 1f*strength, 0.5f).setEaseInOutQuad().setOnUpdate((float val)=>{
focus.nearBlurRadius = startNear * val;
focus.farBlurRadius = startFar * val;
}).setOnComplete(()=>{
depthOfField.enabled = false;
if (strength == 0f)
depthOfField.enabled = false;
}).setIgnoreTimeScale(true);
}
@ -43,7 +45,7 @@ public class ScreenEffects : MonoBehaviour
float startNear = depthOfField.focus.nearBlurRadius;
float startFar = depthOfField.focus.farBlurRadius;
DepthOfField.FocusSettings focus = depthOfField.focus;
LeanTween.value(gameObject, 0f, 1f, 0.5f).setEaseInOutQuad().setOnUpdate((float val)=>{
LeanTween.value(gameObject, 1f*strength, 1f, 0.5f).setEaseInOutQuad().setOnUpdate((float val)=>{
focus.nearBlurRadius = startNear + (originalNearRadius-startNear) * val;
focus.farBlurRadius = startFar + (originalFarRadius-startFar) * val;
}).setIgnoreTimeScale(true);

BIN
IronToad_UnityProject/Assets/_Scenes/GreyBox_Prototype.unity View File


BIN
IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity View File


Loading…
Cancel
Save