Browse Source

added searchlight chase

master
Sagittaeri 7 years ago
parent
commit
6cb91596a1
10 changed files with 22 additions and 121 deletions
  1. +0
    -9
      IronToad_UnityProject/Assets/Animations.meta
  2. BIN
      IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat
  3. +0
    -70
      IronToad_UnityProject/Assets/Lighthouse.cs
  4. +0
    -12
      IronToad_UnityProject/Assets/Lighthouse.cs.meta
  5. +1
    -1
      IronToad_UnityProject/Assets/Scripts/HeavyObject.cs
  6. +21
    -2
      IronToad_UnityProject/Assets/Scripts/UIPanel.cs
  7. +0
    -9
      IronToad_UnityProject/Assets/Sound/Music.meta
  8. +0
    -9
      IronToad_UnityProject/Assets/Sound/SFX.meta
  9. +0
    -9
      IronToad_UnityProject/Assets/Textures.meta
  10. BIN
      IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity

+ 0
- 9
IronToad_UnityProject/Assets/Animations.meta View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 653e5549e4b277c4facae79f936bb3e6
folderAsset: yes
timeCreated: 1484972317
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat View File


+ 0
- 70
IronToad_UnityProject/Assets/Lighthouse.cs View File

@ -1,70 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BansheeGz.BGSpline.Components;
using BansheeGz.BGSpline.Curve;
public class Lighthouse : MonoBehaviour
{
public BGCurve splineCurve;
public List<float> splineDistantPoints = new List<float>();
public float speed = 200f;
public float timePadding = 0.5f;
public float timeBetweenPoints = 3f;
public AnimationCurve animationCurve;
private BGCcCursor splineCursor;
private int targetPoint = 0;
private bool reverseDirection = false;
void Start()
{
splineCursor = splineCurve.GetComponent<BGCcCursor>();
if (splineDistantPoints == null || splineDistantPoints.Count == 0)
{
splineDistantPoints.Add(0f);
for (int i=1; i<splineCurve.PointsCount; i++)
{
BGCurvePointI point = splineCurve.Points[i];
float distance = 0f;
Vector3 temp = splineCursor.Math.CalcPositionByClosestPoint(point.PositionWorld, out distance);
splineDistantPoints.Add(distance);
}
splineDistantPoints.Add(splineCursor.Math.GetDistance());
}
splineCursor.Distance = 0f;
moveToNextPoint();
}
public void moveToNextPoint()
{
LeanTween.delayedCall(gameObject, timeBetweenPoints, ()=>{
if (reverseDirection)
targetPoint--;
else
targetPoint++;
if (targetPoint >= splineDistantPoints.Count)
{
if (splineCurve.Closed)
{
targetPoint = 1;
splineCursor.Distance = 0f;
}
else
{
targetPoint = splineDistantPoints.Count - 2;
reverseDirection = !reverseDirection;
}
}
float start = splineCursor.Distance;
float end = splineDistantPoints[targetPoint];
float distance = Mathf.Abs(end - start);
LeanTween.value(gameObject, start, end, distance / speed + timePadding).setOnUpdate((float val)=>{
splineCursor.Distance = val;
}).setEase(animationCurve).setOnComplete(moveToNextPoint);
});
}
}

+ 0
- 12
IronToad_UnityProject/Assets/Lighthouse.cs.meta View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: e529d146693e04d5983a4fbbb25de5ab
timeCreated: 1484975905
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 1
IronToad_UnityProject/Assets/Scripts/HeavyObject.cs View File

@ -9,7 +9,7 @@ public abstract class HeavyObject : WaterObject {
public float splashPower; public float splashPower;
public override void OnWaterEnter(WaterController water) { public override void OnWaterEnter(WaterController water) {
water.CreateWave(transform.position,splashRadius,splashPower)
water.CreateWave(transform.position,splashRadius,splashPower);
} }
} }

+ 21
- 2
IronToad_UnityProject/Assets/Scripts/UIPanel.cs View File

@ -30,6 +30,7 @@ public class UIPanel : MonoBehaviour
private RectTransform rectTransform; private RectTransform rectTransform;
private CanvasGroup canvasGroup; private CanvasGroup canvasGroup;
private Vector3 originalPos; private Vector3 originalPos;
private bool isShowing = false;
void Awake () void Awake ()
{ {
@ -58,10 +59,13 @@ public class UIPanel : MonoBehaviour
setShowState(); setShowState();
else else
setHideState(); setHideState();
pauseGame();
} }
public void showPanel() public void showPanel()
{ {
// if (isShowing)
// return;
float startAlpha = 0f; float startAlpha = 0f;
float endAlpha = 1f; float endAlpha = 1f;
Vector3 startPos = originalPos; Vector3 startPos = originalPos;
@ -92,11 +96,13 @@ public class UIPanel : MonoBehaviour
canvasGroup.alpha = startAlpha + (endAlpha-startAlpha)*fadeCurve.Evaluate(val); canvasGroup.alpha = startAlpha + (endAlpha-startAlpha)*fadeCurve.Evaluate(val);
rectTransform.anchoredPosition3D = startPos + (endPos-startPos)*showCurve.Evaluate(val); rectTransform.anchoredPosition3D = startPos + (endPos-startPos)*showCurve.Evaluate(val);
transform.localScale = startScale + (endScale-startScale)*showCurve.Evaluate(val); transform.localScale = startScale + (endScale-startScale)*showCurve.Evaluate(val);
}).setOnComplete(setShowState);
}).setOnComplete(setShowState).setIgnoreTimeScale(true);
} }
public void hidePanel() public void hidePanel()
{ {
// if (!isShowing)
// return;
float startAlpha = 1f; float startAlpha = 1f;
float endAlpha = 0f; float endAlpha = 0f;
Vector3 startPos = originalPos; Vector3 startPos = originalPos;
@ -127,7 +133,7 @@ public class UIPanel : MonoBehaviour
canvasGroup.alpha = startAlpha + (endAlpha-startAlpha)*fadeCurve.Evaluate(val); canvasGroup.alpha = startAlpha + (endAlpha-startAlpha)*fadeCurve.Evaluate(val);
rectTransform.anchoredPosition3D = startPos + (endPos-startPos)*hideCurve.Evaluate(val); rectTransform.anchoredPosition3D = startPos + (endPos-startPos)*hideCurve.Evaluate(val);
transform.localScale = startScale + (endScale-startScale)*hideCurve.Evaluate(val); transform.localScale = startScale + (endScale-startScale)*hideCurve.Evaluate(val);
}).setOnComplete(setHideState);
}).setOnComplete(setHideState).setIgnoreTimeScale(true);
} }
public void setShowState() public void setShowState()
@ -137,6 +143,7 @@ public class UIPanel : MonoBehaviour
canvasGroup.alpha = 1f; canvasGroup.alpha = 1f;
rectTransform.anchoredPosition3D = originalPos; rectTransform.anchoredPosition3D = originalPos;
transform.localScale = Vector3.one; transform.localScale = Vector3.one;
isShowing = true;
} }
public void setHideState() public void setHideState()
@ -144,6 +151,7 @@ public class UIPanel : MonoBehaviour
canvasGroup.interactable = false; canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false; canvasGroup.blocksRaycasts = false;
canvasGroup.alpha = 0f; canvasGroup.alpha = 0f;
isShowing = false;
} }
public void quitApplication() public void quitApplication()
@ -154,5 +162,16 @@ public class UIPanel : MonoBehaviour
public void startGame() public void startGame()
{ {
NotificationServer.notify("show GameUI"); NotificationServer.notify("show GameUI");
unpauseGame();
}
public void pauseGame()
{
Time.timeScale = 0f;
}
public void unpauseGame()
{
Time.timeScale = 1f;
} }
} }

+ 0
- 9
IronToad_UnityProject/Assets/Sound/Music.meta View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1715d56e0d2b68246a82993db31014ab
folderAsset: yes
timeCreated: 1484979777
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 9
IronToad_UnityProject/Assets/Sound/SFX.meta View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: de5a3adcedb96f64183518ac89622ade
folderAsset: yes
timeCreated: 1484979777
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 9
IronToad_UnityProject/Assets/Textures.meta View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 2a6e699820a38a544acfc0015eb679a2
folderAsset: yes
timeCreated: 1484972317
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

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


Loading…
Cancel
Save