Skip to content

Commit

Permalink
Added more events
Browse files Browse the repository at this point in the history
  • Loading branch information
Casa\Adrián Meizoso committed Sep 26, 2018
1 parent 883c653 commit 5c30625
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 31 deletions.
19 changes: 19 additions & 0 deletions ShowPT/Assets/BossEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BossEvent : GenericEvent
{
public List<string> tvs;
private TVShowmanManager tVShowmanManager;

private void Start()
{
tVShowmanManager = GameObject.FindGameObjectWithTag("TVShowmanManager").GetComponent<TVShowmanManager>();
}

public override void onEnableEvent()
{
tVShowmanManager.playMessageAllTVs(tvs, type);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions ShowPT/Assets/MidTimeEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MidTimeEvent : GenericEvent
{
public List<string> tvs;
private TVShowmanManager tVShowmanManager;

private void Start()
{
tVShowmanManager = GameObject.FindGameObjectWithTag("TVShowmanManager").GetComponent<TVShowmanManager>();
}

public override void onEnableEvent()
{
tVShowmanManager.playMessageAllTVs(tvs, type);
}
}
13 changes: 13 additions & 0 deletions ShowPT/Assets/MidTimeEvent.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

165 changes: 149 additions & 16 deletions ShowPT/Assets/Scenes/Game.unity

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ShowPT/Assets/Scripts/LilRobot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private void OnCollisionEnter(Collision collision)
{
playerDamaged = true;
collision.gameObject.GetComponent<PlayerHealth>().ChangeHealth(-damage);
collision.gameObject.GetComponent<PlayerHealth>().hitLil();
}
}

Expand Down
25 changes: 24 additions & 1 deletion ShowPT/Assets/Scripts/PlayerHealth.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Expand Down Expand Up @@ -36,6 +37,8 @@ public class PlayerHealth : MonoBehaviour {
public AudioCollection damageCollection;
public AudioCollection tvCollection;
private ulong idClip = 0;
private bool playerDamagedFirstTimeLil;
private bool playerDamagedFirstTimeTurret;

// Use this for initialization
void Start ()
Expand All @@ -45,6 +48,8 @@ void Start ()
deathAnimation = playerCamera.GetComponent<Animator> ();
ctrlAudio = GameObject.FindGameObjectWithTag("CtrlAudio").GetComponent<CtrlAudio>();
tweetSystem = FindObjectOfType<TweetSystem> ();
playerDamagedFirstTimeLil = false;
playerDamagedFirstTimeTurret = false;
}

void Update()
Expand Down Expand Up @@ -135,4 +140,22 @@ public void buyHealth()
{
ChangeHealth(maxHealth);
}

public void hitLil()
{
if (!playerDamagedFirstTimeLil)
{
playerDamagedFirstTimeLil = true;
ctrlAudio.playOneSound(tvCollection.audioGroup, tvCollection[(int)GenericEvent.EventType.FIRSTLIL], Vector3.zero, 0.05f, 0f, tvCollection.priority);
}
}

public void hitTurret()
{
if (!playerDamagedFirstTimeTurret)
{
playerDamagedFirstTimeTurret = true;
ctrlAudio.playOneSound(tvCollection.audioGroup, tvCollection[(int)GenericEvent.EventType.FIRSTORRET], Vector3.zero, 0.05f, 0f, tvCollection.priority);
}
}
}
4 changes: 3 additions & 1 deletion ShowPT/Assets/Scripts/SnitchEnemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class SnitchEnemy : Enemy {
GameObject bridge;

[Header("Sounds")]
public AudioCollection tvCollection;
public AudioClip snichSound;
private ulong idSnichSound;

Expand Down Expand Up @@ -56,7 +57,8 @@ public override void checkHealth()
ctrAudio.stopSound(idSnichSound);
ScoreController.addDead(ScoreController.Enemy.DRON);
bridge.SetActive (true);
generateDeathEffect ();
ctrAudio.playOneSound(tvCollection.audioGroup, tvCollection[(int)GenericEvent.EventType.BRIDGE], Vector3.zero, 0.05f, 0f, tvCollection.priority);
generateDeathEffect ();
}
}

Expand Down
1 change: 1 addition & 0 deletions ShowPT/Assets/Scripts/Turret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public override void shoot()
case "Player":
PlayerHealth playerTemp = hit.transform.gameObject.GetComponent<PlayerHealth> ();
playerTemp.ChangeHealth (-shootDamage);
playerTemp.hitTurret();
break;
}
}
Expand Down
11 changes: 0 additions & 11 deletions ShowPT/Assets/Scripts/TurretEvent.cs

This file was deleted.

0 comments on commit 5c30625

Please sign in to comment.