Browse Source

victory condition, level 1/2 select, multi-lighthouse behavior, boat damage juice, wave height

master
KG 7 years ago
parent
commit
6bd85b6461
20 changed files with 149 additions and 132 deletions
  1. +0
    -82
      IronToad_UnityProject/Assets/Art/Models/pier.obj.meta
  2. BIN
      IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab
  3. +8
    -0
      IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab.meta
  4. +5
    -2
      IronToad_UnityProject/Assets/Scripts/BoatController.cs
  5. +15
    -4
      IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs
  6. +8
    -3
      IronToad_UnityProject/Assets/Scripts/LightBeam.cs
  7. +11
    -2
      IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs
  8. +12
    -2
      IronToad_UnityProject/Assets/Scripts/PlayerController.cs
  9. +11
    -0
      IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs
  10. +7
    -2
      IronToad_UnityProject/Assets/Scripts/Searchlight.cs
  11. +10
    -0
      IronToad_UnityProject/Assets/Scripts/UIPanel.cs
  12. +49
    -0
      IronToad_UnityProject/Assets/Scripts/VictoryScript.cs
  13. +12
    -0
      IronToad_UnityProject/Assets/Scripts/VictoryScript.cs.meta
  14. +1
    -1
      IronToad_UnityProject/Assets/Scripts/WaterController.cs
  15. +0
    -9
      IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d
  16. +0
    -8
      IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d.meta
  17. +0
    -9
      IronToad_UnityProject/Assets/Sound.meta~HEAD_0
  18. +0
    -8
      IronToad_UnityProject/Assets/Sound.meta~HEAD_0.meta
  19. BIN
      IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity
  20. BIN
      IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset

+ 0
- 82
IronToad_UnityProject/Assets/Art/Models/pier.obj.meta View File

@ -1,82 +0,0 @@
fileFormatVersion: 2
guid: 37549450629db464abffe54861590cf3
timeCreated: 1485008673
licenseType: Free
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: pCylinder3
100002: //RootNode
400000: pCylinder3
400002: //RootNode
2300000: pCylinder3
3300000: pCylinder3
4300000: pCylinder3
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab View File


+ 8
- 0
IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 785489b73767a41c49ff69b387dd4ddc
timeCreated: 1485044195
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 5
- 2
IronToad_UnityProject/Assets/Scripts/BoatController.cs View File

@ -15,7 +15,7 @@ public class BoatController : BuoyantObject {
// Use this for initialization // Use this for initialization
void Start() { void Start() {
NotificationServer.register("switch off", switchOff);
} }
void Update() { void Update() {
@ -85,7 +85,10 @@ public class BoatController : BuoyantObject {
applyBreak = true; applyBreak = true;
} }
private void switchOff(object _)
{
rb.velocity = Vector3.zero;
}
} }

+ 15
- 4
IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs View File

@ -14,11 +14,16 @@ public class CustomSmoothFollow : MonoBehaviour
private int layerMask; private int layerMask;
[Range (0,360)] [Range (0,360)]
public float offsetAngle = 90; public float offsetAngle = 90;
public float shakeStrength = 5f;
private float shakeCurrent;
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
layerMask = LayerMask.NameToLayer(layerToMask); layerMask = LayerMask.NameToLayer(layerToMask);
NotificationServer.register("shake camera", shake);
} }
// Update is called once per frame // Update is called once per frame
@ -74,18 +79,24 @@ public class CustomSmoothFollow : MonoBehaviour
// Set the height of the camera // Set the height of the camera
transform.position = new Vector3(currentSide, currentHeight, currentDistance); transform.position = new Vector3(currentSide, currentHeight, currentDistance);
if (shakeCurrent > 0f)
{
transform.position += Random.insideUnitSphere * shakeStrength;
shakeCurrent -= Time.deltaTime * shakeStrength;
}
// Always look at the target // Always look at the target
Vector3 lookTarget = target.position; Vector3 lookTarget = target.position;
lookTarget.z = transform.position.z; lookTarget.z = transform.position.z;
transform.LookAt(lookTarget); transform.LookAt(lookTarget);
}
public void shake()
{
shakeCurrent = shakeStrength;
} }
private Vector3 RotatePointAroundPivot(Vector3 point,Vector3 pivot,float angles ) {
private Vector3 RotatePointAroundPivot(Vector3 point,Vector3 pivot,float angles ){
Vector3 dir = point - pivot; // get point direction relative to pivot Vector3 dir = point - pivot; // get point direction relative to pivot
dir = Quaternion.Euler(angles * Vector3.up) * dir; // rotate it dir = Quaternion.Euler(angles * Vector3.up) * dir; // rotate it
point = dir + pivot; // calculate rotated point point = dir + pivot; // calculate rotated point

+ 8
- 3
IronToad_UnityProject/Assets/Scripts/LightBeam.cs View File

@ -31,8 +31,13 @@ public class LightBeam : MonoBehaviour {
GetComponent<Animator>().SetBool("isSeen", false); GetComponent<Animator>().SetBool("isSeen", false);
} }
private void switchOff() {
lightBeam.gameObject.SetActive(false);
target.gameObject.SetActive(false);
private void switchOff(object offObject) {
GameObject offGO = offObject as GameObject;
// Debug.LogWarning(offGO + " vs " + gameObject);
if (offGO == gameObject)
{
lightBeam.gameObject.SetActive(false);
target.gameObject.SetActive(false);
}
} }
} }

+ 11
- 2
IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs View File

@ -8,9 +8,12 @@ public class LighthouseLanding : MonoBehaviour
private bool isTriggering = false; private bool isTriggering = false;
static private Transform lastTriggered;
void Awake() void Awake()
{ {
NotificationServer.register("statechange Searchlight", searchlightStateChanged); NotificationServer.register("statechange Searchlight", searchlightStateChanged);
NotificationServer.register("switch off", switchBeamOff);
} }
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
@ -26,6 +29,7 @@ public class LighthouseLanding : MonoBehaviour
isTriggering = true; isTriggering = true;
NotificationServer.notify("show TakeoverButton"); NotificationServer.notify("show TakeoverButton");
lastTriggered = transform;
} }
void OnTriggerExit(Collider other) void OnTriggerExit(Collider other)
@ -54,9 +58,14 @@ public class LighthouseLanding : MonoBehaviour
public void switchOff() public void switchOff()
{ {
switchedOff = true;
NotificationServer.notify("hide TakeoverButton"); NotificationServer.notify("hide TakeoverButton");
NotificationServer.notify("play sfx", "assassination:0.75"); NotificationServer.notify("play sfx", "assassination:0.75");
NotificationServer.notify("switch off");
NotificationServer.notify("switch off", lastTriggered.parent.gameObject);
} }
public void switchBeamOff(object _)
{
if (transform == lastTriggered)
switchedOff = true;
}
} }

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

@ -3,7 +3,8 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class PlayerController : MonoBehaviour { public class PlayerController : MonoBehaviour {
public float cooldownWaveCreate = 0.5f;
private float timeOfLastWave;
public bool isLocked = false; public bool isLocked = false;
public float power; public float power;
@ -11,6 +12,7 @@ public class PlayerController : MonoBehaviour {
public float time; public float time;
public GameObject waveRing; public GameObject waveRing;
public ParticleSystem boatHitParticle;
public int life = 3; public int life = 3;
public float lastDamageTime = 0; public float lastDamageTime = 0;
@ -37,6 +39,11 @@ public class PlayerController : MonoBehaviour {
void Update () { void Update () {
if (Input.GetButtonDown("Fire1") && !isLocked) { if (Input.GetButtonDown("Fire1") && !isLocked) {
if (cooldownWaveCreate > Time.timeSinceLevelLoad - timeOfLastWave)
return;
timeOfLastWave = Time.timeSinceLevelLoad;
// Debug.Log("Click"); // Debug.Log("Click");
RaycastHit hit; RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
@ -69,6 +76,9 @@ public class PlayerController : MonoBehaviour {
} }
public void takeOneDamage() { public void takeOneDamage() {
// NotificationServer.notify("shake camera");
NotificationServer.notify("flash damage");
boatHitParticle.Play();
if (Time.time > lastDamageTime + 2 && life > 0) { if (Time.time > lastDamageTime + 2 && life > 0) {
setLife(life - 1); setLife(life - 1);
lastDamageTime = Time.time; lastDamageTime = Time.time;
@ -76,7 +86,7 @@ public class PlayerController : MonoBehaviour {
{ {
NotificationServer.notify("fade bgm"); NotificationServer.notify("fade bgm");
NotificationServer.notify("play sfx", "shipSpotted:0.5"); NotificationServer.notify("play sfx", "shipSpotted:0.5");
NotificationServer.notify("play sfx", "sinkingShip:0.75");
NotificationServer.notify("play sfx", "sinkingShip_2:0.75");
NotificationServer.notify("show GameOverPanel"); NotificationServer.notify("show GameOverPanel");
NotificationServer.notify("hide GameUI"); NotificationServer.notify("hide GameUI");
} }

+ 11
- 0
IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs View File

@ -7,10 +7,13 @@ public class ScreenEffects : MonoBehaviour
{ {
public DepthOfField depthOfField; public DepthOfField depthOfField;
public float strength = 0f; public float strength = 0f;
public CanvasGroup flashCanvas;
private float originalNearRadius; private float originalNearRadius;
private float originalFarRadius; private float originalFarRadius;
private int flashID;
void Start () void Start ()
{ {
depthOfField = GetComponent<DepthOfField>(); depthOfField = GetComponent<DepthOfField>();
@ -21,6 +24,7 @@ public class ScreenEffects : MonoBehaviour
NotificationServer.register("show GameUI", showGame); NotificationServer.register("show GameUI", showGame);
NotificationServer.register("hide GameUI", hideGame); NotificationServer.register("hide GameUI", hideGame);
NotificationServer.register("flash damage", flashDamage);
} }
public void showGame() public void showGame()
@ -51,4 +55,11 @@ public class ScreenEffects : MonoBehaviour
}).setIgnoreTimeScale(true); }).setIgnoreTimeScale(true);
} }
public void flashDamage()
{
LeanTween.cancel(flashID);
flashID = LeanTween.alphaCanvas(flashCanvas, 1f, 0.2f).setEaseInOutCubic().setOnComplete(()=>{
LeanTween.alphaCanvas(flashCanvas, 0f, 0.6f).setEaseInOutCubic();
}).uniqueId;
}
} }

+ 7
- 2
IronToad_UnityProject/Assets/Scripts/Searchlight.cs View File

@ -40,6 +40,7 @@ public class Searchlight : MonoBehaviour
{ {
NotificationServer.register("statechange Searchlight safe", stateSafe); NotificationServer.register("statechange Searchlight safe", stateSafe);
NotificationServer.register("statechange Searchlight returning", stateReturning); NotificationServer.register("statechange Searchlight returning", stateReturning);
NotificationServer.register("spotted boat", spottedBoat);
if (!instants.Contains(this)) if (!instants.Contains(this))
instants.Add(this); instants.Add(this);
@ -50,7 +51,6 @@ public class Searchlight : MonoBehaviour
if (other.tag != "Player" || playerHidden ) if (other.tag != "Player" || playerHidden )
return; return;
chased = other; chased = other;
isTriggering = true;
if (state != SearchState.Chasing) if (state != SearchState.Chasing)
{ {
state = SearchState.Chasing; state = SearchState.Chasing;
@ -58,7 +58,6 @@ public class Searchlight : MonoBehaviour
NotificationServer.notify("chasing boat"); NotificationServer.notify("chasing boat");
} }
LeanTween.cancel(gameObject, false); LeanTween.cancel(gameObject, false);
LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase);
NotificationServer.notify("spotted boat"); NotificationServer.notify("spotted boat");
} }
@ -95,6 +94,12 @@ public class Searchlight : MonoBehaviour
// LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase); // LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase);
} }
public void spottedBoat()
{
isTriggering = true;
LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase);
}
public void chase() public void chase()
{ {
if (isTriggering) if (isTriggering)

+ 10
- 0
IronToad_UnityProject/Assets/Scripts/UIPanel.cs View File

@ -175,4 +175,14 @@ public class UIPanel : MonoBehaviour
{ {
Time.timeScale = 1f; Time.timeScale = 1f;
} }
public void disableObject(GameObject go)
{
go.SetActive(false);
}
public void enableObject(GameObject go)
{
go.SetActive(true);
}
} }

+ 49
- 0
IronToad_UnityProject/Assets/Scripts/VictoryScript.cs View File

@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VictoryScript : MonoBehaviour
{
private bool isTriggering = false;
void OnTriggerEnter(Collider other)
{
if (other.tag != "Player")
return;
if (Searchlight.state == Searchlight.SearchState.Chasing)
return;
if (isTriggering)
return;
isTriggering = true;
NotificationServer.notify("show VictoryButton");
}
void OnTriggerExit(Collider other)
{
if (other.tag != "Player")
return;
if (!isTriggering)
return;
isTriggering = false;
NotificationServer.notify("hide VictoryButton");
}
void searchlightStateChanged()
{
if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing)
{
isTriggering = false;
NotificationServer.notify("hide VictoryButton");
}
}
public void victoryClicked()
{
NotificationServer.notify("fade bgm");
NotificationServer.notify("play sfx", "shipSpotted_2:0.5");
NotificationServer.notify("show VictoryPanel");
NotificationServer.notify("hide GameUI");
}
}

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

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

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

@ -48,7 +48,7 @@ public class WaterController : MonoBehaviour {
point.y = transform.position.y; point.y = transform.position.y;
Vector3 pos = point; Vector3 pos = point;
pos.y += 1;
pos.y += 6f;
Quaternion rot = Quaternion.Euler(-90, 0, 0); Quaternion rot = Quaternion.Euler(-90, 0, 0);
if (rippleEffect != null) { if (rippleEffect != null) {

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

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 844c4f25011b45348a5db5bc5b4f956e
folderAsset: yes
timeCreated: 1485037848
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 8
IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4f48e22f51b6449849bfe949e93bd014
timeCreated: 1485054810
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

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

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: e3b0c439ea6f28c4fb3ce6bc58682b6b
folderAsset: yes
timeCreated: 1485052873
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 8
IronToad_UnityProject/Assets/Sound.meta~HEAD_0.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c4dadf9d2dcd00b41a75fe2f9e83af94
timeCreated: 1485059760
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

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


BIN
IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset View File


Loading…
Cancel
Save