Browse Source

fixed bugs, chase juicing

master
KG 7 years ago
parent
commit
4342f4bd17
10 changed files with 59 additions and 16 deletions
  1. +1
    -0
      IronToad_UnityProject/Assets/Scripts/AlertController.cs
  2. +5
    -0
      IronToad_UnityProject/Assets/Scripts/AudioController.cs
  3. +5
    -0
      IronToad_UnityProject/Assets/Scripts/Catapult.cs
  4. +5
    -0
      IronToad_UnityProject/Assets/Scripts/LightBeam.cs
  5. +6
    -0
      IronToad_UnityProject/Assets/Scripts/Lighthouse.cs
  6. +5
    -0
      IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs
  7. +22
    -1
      IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs
  8. +10
    -15
      IronToad_UnityProject/Assets/Scripts/Searchlight.cs
  9. BIN
      IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity
  10. BIN
      IronToad_UnityProject/ProjectSettings/GraphicsSettings.asset

+ 1
- 0
IronToad_UnityProject/Assets/Scripts/AlertController.cs View File

@ -42,6 +42,7 @@ public class AlertController : MonoBehaviour
}).setOnComplete(()=>{
NotificationServer.notify("hide AlertTimer");
NotificationServer.notify("statechange Searchlight returning");
NotificationServer.notify("statechange Searchlight");
text.text = "hidden...";
LeanTween.delayedCall(text.gameObject, 2f, ()=>{

+ 5
- 0
IronToad_UnityProject/Assets/Scripts/AudioController.cs View File

@ -15,6 +15,8 @@ public class AudioController : MonoBehaviour
public AudioClip[] ambClips;
public AudioClip[] sfxClips;
private Searchlight.SearchState searchState;
void Awake()
{
NotificationServer.register("play bgm", playBgm);
@ -57,6 +59,9 @@ public class AudioController : MonoBehaviour
public void searchlightStateChanged()
{
if (searchState == Searchlight.state)
return;
searchState = Searchlight.state;
if (Searchlight.state == Searchlight.SearchState.Chasing)
{
NotificationServer.notify("play sfx", "spottedDialogue:0.9");

+ 5
- 0
IronToad_UnityProject/Assets/Scripts/Catapult.cs View File

@ -26,6 +26,8 @@ public class Catapult : MonoBehaviour
private Collider boulderCollider;
private ParticleSystem boulderParticleSystem;
private Searchlight.SearchState searchState;
void Start ()
{
splineCursor = splineCurve.GetComponent<BGCcCursor>();
@ -51,6 +53,9 @@ public class Catapult : MonoBehaviour
public void searchlightStateChanged()
{
if (searchState == Searchlight.state)
return;
searchState = Searchlight.state;
LeanTween.cancel(splineObjectTranslate.ObjectToManipulate.gameObject, true);
if (Searchlight.state == Searchlight.SearchState.Chasing)
launchBoulder();

+ 5
- 0
IronToad_UnityProject/Assets/Scripts/LightBeam.cs View File

@ -7,6 +7,8 @@ public class LightBeam : MonoBehaviour {
public Transform target;
public Transform lightBeam;
private Searchlight.SearchState searchState;
// Use this for initialization
void Start () {
NotificationServer.register("statechange Searchlight", toggleState);
@ -22,6 +24,9 @@ public class LightBeam : MonoBehaviour {
}
private void toggleState() {
if (searchState == Searchlight.state)
return;
searchState = Searchlight.state;
GetComponent<Animator>().SetBool("isSeen", (Searchlight.state == Searchlight.SearchState.Chasing));
}

+ 6
- 0
IronToad_UnityProject/Assets/Scripts/Lighthouse.cs View File

@ -19,6 +19,7 @@ public class Lighthouse : MonoBehaviour
private int targetPoint = 0;
private bool reverseDirection = false;
private bool midpoint = false;
private Searchlight.SearchState searchState;
void Start()
{
@ -38,6 +39,7 @@ public class Lighthouse : MonoBehaviour
splineDistantPoints.Add(splineCursor.Math.GetDistance());
}
splineCursor.Distance = 0f;
searchState = Searchlight.SearchState.Spline;
moveToNextPoint();
NotificationServer.register("statechange Searchlight", searchlightStateChanged);
@ -80,6 +82,9 @@ public class Lighthouse : MonoBehaviour
public void searchlightStateChanged()
{
if (searchState == Searchlight.state)
return;
searchState = Searchlight.state;
LeanTween.cancel(gameObject, false);
if (Searchlight.state == Searchlight.SearchState.Chasing)
{
@ -116,6 +121,7 @@ public class Lighthouse : MonoBehaviour
reverseDirection = false;
targetPoint = 0;
splineObjectTranslate.ObjectToManipulate.position = splineCursor.CalculatePosition();
searchState = Searchlight.SearchState.Spline;
moveToNextPoint();
NotificationServer.notify("statechange Searchlight safe");
}

+ 5
- 0
IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs View File

@ -8,6 +8,7 @@ public class LighthouseLanding : MonoBehaviour
private bool isTriggering = false;
private Searchlight.SearchState searchState;
static private Transform lastTriggered;
void Awake()
@ -48,6 +49,10 @@ public class LighthouseLanding : MonoBehaviour
void searchlightStateChanged()
{
if (searchState == Searchlight.state)
return;
searchState = Searchlight.state;
if (switchedOff)
return;
if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing)

+ 22
- 1
IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs View File

@ -8,7 +8,9 @@ public class ScreenEffects : MonoBehaviour
public DepthOfField depthOfField;
public float strength = 0f;
public CanvasGroup flashCanvas;
public float alertFlashAlpha = 0f;
private float baseFlashAlpha;
private float originalNearRadius;
private float originalFarRadius;
@ -25,6 +27,7 @@ public class ScreenEffects : MonoBehaviour
NotificationServer.register("show GameUI", showGame);
NotificationServer.register("hide GameUI", hideGame);
NotificationServer.register("flash damage", flashDamage);
NotificationServer.register("statechange Searchlight", searchlightStateChanged);
}
public void showGame()
@ -40,6 +43,12 @@ public class ScreenEffects : MonoBehaviour
if (strength == 0f)
depthOfField.enabled = false;
}).setIgnoreTimeScale(true);
float target = 0f;
if (Searchlight.state == Searchlight.SearchState.Chasing)
target = alertFlashAlpha;
LeanTween.cancel(flashID);
flashID = LeanTween.alphaCanvas(flashCanvas, target, 0.5f).setEaseInOutCubic().setIgnoreTimeScale(true).uniqueId;
}
public void hideGame()
@ -59,7 +68,19 @@ public class ScreenEffects : MonoBehaviour
{
LeanTween.cancel(flashID);
flashID = LeanTween.alphaCanvas(flashCanvas, 1f, 0.2f).setEaseInOutCubic().setOnComplete(()=>{
LeanTween.alphaCanvas(flashCanvas, 0f, 0.6f).setEaseInOutCubic();
float target = 0f;
if (Searchlight.state == Searchlight.SearchState.Chasing)
target = alertFlashAlpha;
flashID = LeanTween.alphaCanvas(flashCanvas, target, 0.8f).setEaseInOutCubic().uniqueId;
}).uniqueId;
}
public void searchlightStateChanged()
{
float target = 0f;
if (Searchlight.state == Searchlight.SearchState.Chasing)
target = alertFlashAlpha;
LeanTween.cancel(flashID);
flashID = LeanTween.alphaCanvas(flashCanvas, target, 0.5f).setEaseInOutCubic().uniqueId;
}
}

+ 10
- 15
IronToad_UnityProject/Assets/Scripts/Searchlight.cs View File

@ -24,6 +24,8 @@ public class Searchlight : MonoBehaviour
public static bool playerHidden = false;
private int chaseID;
private static List<Searchlight> instants = new List<Searchlight>();
public static bool isTriggeringAtLeastOne()
@ -78,46 +80,39 @@ public class Searchlight : MonoBehaviour
public void stateSafe()
{
state = SearchState.Spline;
// NotificationServer.notify("statechange Searchlight");
LeanTween.cancel(chaseID, false);
}
public void stateReturning()
{
state = SearchState.Returning;
NotificationServer.notify("statechange Searchlight");
}
public void stateChanged()
{
LeanTween.cancel(gameObject, false);
// if (state == SearchState.Chasing)
// LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase);
LeanTween.cancel(chaseID, false);
}
public void spottedBoat()
{
isTriggering = true;
LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase);
chaseID = LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase).uniqueId;
}
public void chase()
{
if (isTriggering)
{
LeanTween.delayedCall(gameObject, timeBetweenChase, chase);
chaseID = LeanTween.delayedCall(gameObject, timeBetweenChase, chase).uniqueId;
}
else
{
LeanTween.delayedCall(gameObject, timeBetweenChase, ()=>{
chaseID = LeanTween.delayedCall(gameObject, timeBetweenChase, ()=>{
Vector3 start = transform.position;
Vector3 end = chased.transform.position
+ Vector3.right * Random.Range(-randomFactor, randomFactor)
+ Vector3.forward * Random.Range(-randomFactor, randomFactor);
float distance = (end - start).magnitude;
LeanTween.value(gameObject, 0f, 1f, distance / speed + timePadding).setOnUpdate((float val)=>{
chaseID = LeanTween.value(gameObject, 0f, 1f, distance / speed + timePadding).setOnUpdate((float val)=>{
transform.position = start + (end-start)*val;
}).setEase(animationCurve).setOnComplete(chase);
});
}).setEase(animationCurve).setOnComplete(chase).uniqueId;
}).uniqueId;
}
}
}

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


BIN
IronToad_UnityProject/ProjectSettings/GraphicsSettings.asset View File


Loading…
Cancel
Save