
1.搭建完了场景3,等待补充动画和相关演出CG
建议:
(1.场景3的前排树的动画很怪,美术看看要不要调整
(2.多张合一张的逐帧动画注意分割像素割齐,不要一个宽100一个宽110这样,保证每一个单元的分辨率一样
可以摸鱼吗😿
53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 可交互物件基类
|
|
/// </summary>
|
|
public class Interactable : Event
|
|
{
|
|
|
|
protected Player player;
|
|
protected virtual void Start()
|
|
{
|
|
//检查触发器
|
|
if (GetComponent<Collider2D>() == null)
|
|
{
|
|
Debug.LogError(this.GetType() + ": 没有碰撞盒");
|
|
}
|
|
else if(GetComponent<Collider2D>().isTrigger == false)
|
|
{
|
|
Debug.LogError(this.GetType() + ": 碰撞盒没有设置为触发器");
|
|
}
|
|
}
|
|
|
|
void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
if (other.TryGetComponent<PlayerInteract>(out PlayerInteract playerInteract))
|
|
{
|
|
playerInteract.SetCatched(this);
|
|
|
|
}
|
|
if (other.TryGetComponent<Player>(out Player player))
|
|
{
|
|
this.player = player;
|
|
}
|
|
|
|
}
|
|
|
|
void OnTriggerExit2D(Collider2D other)
|
|
{
|
|
if (other.TryGetComponent<PlayerInteract>(out PlayerInteract playerInteract))
|
|
{
|
|
playerInteract.CancleCatched(this);
|
|
}
|
|
}
|
|
|
|
internal void OnTriggerEnter2D()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|