Extralife корректно работает.

This commit is contained in:
DyatelO 2021-11-26 04:44:43 +03:00
parent b48beabc1a
commit 5cd2026b19
7 changed files with 52 additions and 78 deletions

View File

@ -4754,7 +4754,7 @@ Transform:
m_GameObject: {fileID: 6736513976106828952}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 0.76523924, y: 0.76523924, z: 0.76523924}
m_LocalScale: {x: 0.76523924, y: 0.7652393, z: 0.7652393}
m_Children:
- {fileID: 6736513976106619780}
- {fileID: 6736513976106671486}
@ -9476,7 +9476,7 @@ AudioSource:
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 101106cd810615041bb13f121e59a2d7, type: 3}
m_audioClip: {fileID: 8300000, guid: e9d3f46b0b5ba9f4cada050219138aac, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1.3

View File

@ -12,7 +12,6 @@ GameObject:
- component: {fileID: 8305872390849316397}
- component: {fileID: 8305872390849316386}
- component: {fileID: 8305872390849316387}
- component: {fileID: 253748612048010415}
m_Layer: 0
m_Name: BombPref
m_TagString: Untagged
@ -81,34 +80,6 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &253748612048010415
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8305872390849316384}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a99dc0f9656d2241b5ada4edc0765ee, type: 3}
m_Name:
m_EditorClassIdentifier:
state: {fileID: 8834890311105204208, guid: 935cb93f0fb421b47bac368a21e42353, type: 3}
hit_LightingAudio: {fileID: 8300000, guid: 6c42231c18643dc4d9d8f8d15bc4735b, type: 3}
hit_LaserAudio: {fileID: 8300000, guid: 75cd25f85e881bc458b1dd2f2bd8d84a, type: 3}
hit_TowerFireballAudio: {fileID: 8300000, guid: ab5fd4a38b69eb84f8ca0b8919cedd9c,
type: 3}
hit_SFX:
- {fileID: 8300000, guid: 6c42231c18643dc4d9d8f8d15bc4735b, type: 3}
- {fileID: 8300000, guid: 75cd25f85e881bc458b1dd2f2bd8d84a, type: 3}
- {fileID: 8300000, guid: ab5fd4a38b69eb84f8ca0b8919cedd9c, type: 3}
throw_SFX:
- {fileID: 8300000, guid: 9ea918c6c23577f4e885a8490d2f2046, type: 3}
- {fileID: 8300000, guid: 4af8bb0096e5d15489b02be84b6ce2a4, type: 3}
- {fileID: 8300000, guid: dbba45d74994bff4e8b406722fc8f468, type: 3}
_controller: {fileID: 8834890311105204220, guid: 935cb93f0fb421b47bac368a21e42353,
type: 3}
bonusSound: {fileID: 8300000, guid: e9d3f46b0b5ba9f4cada050219138aac, type: 3}
--- !u!1001 &8305872391170760256
PrefabInstance:
m_ObjectHideFlags: 0
@ -121,16 +92,6 @@ PrefabInstance:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6736513976106618110, guid: 18fb35664a7886842aa1702160b555a8,
type: 3}
propertyPath: m_LocalScale.y
value: 0.7652393
objectReference: {fileID: 0}
- target: {fileID: 6736513976106618110, guid: 18fb35664a7886842aa1702160b555a8,
type: 3}
propertyPath: m_LocalScale.z
value: 0.7652393
objectReference: {fileID: 0}
- target: {fileID: 6736513976106618110, guid: 18fb35664a7886842aa1702160b555a8,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -2797,7 +2797,6 @@ GameObject:
- component: {fileID: 1102420994}
- component: {fileID: 1102420995}
- component: {fileID: 1102420996}
- component: {fileID: 1102421000}
- component: {fileID: 1102420997}
- component: {fileID: 1102420999}
- component: {fileID: 1102420998}
@ -3105,21 +3104,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6b5dadb9684306343863ce74df4f19db, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1102421000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1102420987}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8dc4cc07f3bed18489377bd6a954befc, type: 3}
m_Name:
m_EditorClassIdentifier:
victorySound: {fileID: 8300000, guid: c5d6f7a31e8ea824a8e65927b92b86f8, type: 3}
defeatSound: {fileID: 8300000, guid: 8e59fee47fa858a419bdc652dc2a9a71, type: 3}
audioSource: {fileID: 1102420997}
--- !u!114 &1105100998 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5359326301570881751, guid: a72be70db1163c14b8b7a3cb1c00a59d,
@ -4726,8 +4710,8 @@ GameObject:
- component: {fileID: 1801060033}
- component: {fileID: 1801060039}
- component: {fileID: 1801060035}
- component: {fileID: 1801060029}
- component: {fileID: 1801060038}
- component: {fileID: 1801060029}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
@ -4868,7 +4852,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 0.3
m_Volume: 0.5
m_Pitch: 1
Loop: 0
Mute: 0
@ -5083,6 +5067,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8dc4cc07f3bed18489377bd6a954befc, type: 3}
m_Name:
m_EditorClassIdentifier:
extralife: {fileID: 1801060037}
victorySound: {fileID: 8300000, guid: c5d6f7a31e8ea824a8e65927b92b86f8, type: 3}
defeatSound: {fileID: 8300000, guid: 8e59fee47fa858a419bdc652dc2a9a71, type: 3}
audioSource: {fileID: 1801060029}
@ -27342,9 +27327,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tilePosition: {x: 0, y: 0, z: 0}
canMove: 1
canBeAttacked: 1
canBuildHere: 1
canMove: 0
canBeAttacked: 0
canBuildHere: 0
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
easyCaptureFor:
@ -50679,9 +50664,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tilePosition: {x: 0, y: 0, z: 0}
canMove: 1
canBeAttacked: 1
canBuildHere: 1
canMove: 0
canBeAttacked: 0
canBuildHere: 0
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
easyCaptureFor:

View File

@ -4,15 +4,23 @@ using UnityEngine;
public class Extralife : MonoBehaviour
{
public int life = 2;
public int life = 1;
[SerializeField] private DeathMenu menu;
void Update()
/* void Update()
{
if(life == 0)
{
//Count.lifesValue -= 1;
menu.LoadMenu();
}
}*/
private void OnTriggerEnter(Collider other) {
if(life < 0)
{
//Count.lifesValue -= 1;
menu.LoadMenu();
}
}
}

View File

@ -10,27 +10,32 @@ public class RewardExtraLife : MonoBehaviour
private string RewardUnitId = "ca-app-pub-3940256099942544/5224354917"; //ca-app-pub-6397060103571541~3496155288
private RewardedAd rewardedAd;
[SerializeField] private Extralife _extraLife;
private int extralife;
private int lifeCount;
private void OnEnable() {
lifeCount = _extraLife.life;
this.rewardedAd = new RewardedAd(RewardUnitId);
AdRequest adRequest = new AdRequest.Builder().Build();
this.rewardedAd.LoadAd(adRequest);
this.rewardedAd.OnUserEarnedReward += HandleEarnedReward;
}
private void OnTriggerEnter(Collider other) {
}
private void Update() {
//extralife =_extraLife.life;
_extraLife.life = lifeCount - 1;
}
private void HandleEarnedReward(object sender, Reward e)
{
extralife = _extraLife.life ;
//_extraLife.life ;
//extralife--;
//_extraLife.life--;
Count.lifesValue -= 1;
_extraLife.life = Count.lifesValue;
lifeCount -= 1;
_extraLife.life = lifeCount;
}
public void ShowAd()

View File

@ -34,7 +34,7 @@ public class AudioChanger : MonoBehaviour
if(bonusSound != null)
{
aSourse.volume = _startVolume ;
aSourse.volume = _startVolume ;
aSourse.PlayOneShot(bonusSound);
}

View File

@ -6,19 +6,34 @@ using UnityEngine.UI;
public class VictoryOrNot : MonoBehaviour
{
//[SerializeField] private GameObject greyHeart;
//[SerializeField] private Extralife extralife;
private string zero = "0";
[SerializeField] private Extralife extralife;
//private string zero = "0";
[SerializeField] private AudioClip victorySound;
[SerializeField] private AudioClip defeatSound;
[SerializeField] private AudioSource audioSource;
private float volume;
private void Awake() {
volume = audioSource.volume;
private void Awake()
{
//if(extralife.life < 0)
volume = 0.5f * audioSource.volume;
//PlayGameOver();
}
private void Update() {
if(extralife.life < -1)
{
PlayGameOver();
}
//volume = 0.5f * audioSource.volume;
}
public void Play()
public void PlayGameOver()
{