update samples

This commit is contained in:
hevinci
2023-03-09 17:28:40 +08:00
parent c976221cbb
commit 9739fe2b79
19 changed files with 79 additions and 28 deletions
@@ -25,7 +25,8 @@ public class EntityAsteroid : MonoBehaviour
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("PlayerBullet"))
var name = other.gameObject.name;
if (name.StartsWith("player"))
{
BattleEventDefine.AsteroidExplosion.SendEventMessage(this.transform.position, this.transform.rotation);
_handle.Restore();
@@ -34,7 +35,8 @@ public class EntityAsteroid : MonoBehaviour
}
void OnTriggerExit(Collider other)
{
if (other.CompareTag("Boundary"))
var name = other.gameObject.name;
if (name.StartsWith("Boundary"))
{
_handle.Restore();
_handle = null;
@@ -19,25 +19,27 @@ public class EntityBullet : MonoBehaviour
void Awake()
{
_rigidbody = this.transform.GetComponent<Rigidbody>();
_rigidbody = this.transform.GetComponent<Rigidbody>();
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Boundary"))
var name = other.gameObject.name;
if (name.StartsWith("Boundary"))
return;
if (this.gameObject.CompareTag("EnemyBullet"))
var goName = this.gameObject.name;
if (goName.StartsWith("enemy_bullet"))
{
if (other.CompareTag("Enemy") == false)
if (name.StartsWith("enemy") == false)
{
_handle.Restore();
_handle = null;
}
}
if (this.gameObject.CompareTag("PlayerBullet"))
if (goName.StartsWith("player_bullet"))
{
if (other.CompareTag("Player") == false)
if (name.StartsWith("player") == false)
{
_handle.Restore();
_handle = null;
@@ -46,7 +48,8 @@ public class EntityBullet : MonoBehaviour
}
void OnTriggerExit(Collider other)
{
if (other.CompareTag("Boundary"))
var name = other.gameObject.name;
if (name.StartsWith("Boundary"))
{
_handle.Restore();
_handle = null;
@@ -68,7 +68,8 @@ public class EntityEnemy : MonoBehaviour
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("PlayerBullet"))
var name = other.gameObject.name;
if (name.StartsWith("player"))
{
BattleEventDefine.EnemyDead.SendEventMessage(this.transform.position, this.transform.rotation);
_handle.Restore();
@@ -77,7 +78,8 @@ public class EntityEnemy : MonoBehaviour
}
void OnTriggerExit(Collider other)
{
if (other.CompareTag("Boundary"))
var name = other.gameObject.name;
if (name.StartsWith("Boundary"))
{
_handle.Restore();
_handle = null;
@@ -54,7 +54,8 @@ public class EntityPlayer : MonoBehaviour
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Enemy") || other.CompareTag("EnemyBullet") || other.CompareTag("Asteroid"))
var name = other.gameObject.name;
if (name.StartsWith("enemy") || name.StartsWith("asteroid"))
{
BattleEventDefine.PlayerDead.SendEventMessage(this.transform.position, this.transform.rotation);
_handle.Restore();
@@ -142,7 +142,7 @@ internal class FsmInitialize : IStateNode
throw new NotImplementedException();
}
public FileStream LoadFromStream(DecryptFileInfo fileInfo)
public Stream LoadFromStream(DecryptFileInfo fileInfo)
{
BundleStream bundleStream = new BundleStream(fileInfo.FilePath, FileMode.Open);
return bundleStream;
@@ -3,17 +3,26 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UniFramework.Window;
using YooAsset;
[WindowAttribute(100, false)]
public class UIAboutWindow : UIWindow
{
private Text _info;
private RawFileOperationHandle _handle;
public override void OnCreate()
{
var maskBtn = this.transform.Find("mask").GetComponent<Button>();
maskBtn.onClick.AddListener(OnClicMaskBtn);
_info = this.transform.Find("bg/info").GetComponent<Text>();
_handle = YooAssets.LoadRawFileAsync("about");
_handle.Completed += _handle_Completed;
}
public override void OnDestroy()
{
_handle.Release();
}
public override void OnRefresh()
{
@@ -22,6 +31,11 @@ public class UIAboutWindow : UIWindow
{
}
private void _handle_Completed(RawFileOperationHandle obj)
{
_info.text = _handle.GetRawFileText();
}
private void OnClicMaskBtn()
{
UniWindow.CloseWindow<UIAboutWindow>();