2021-08-28 00:49:37 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class AReadyMachine : Interactive
|
|
|
|
{
|
|
|
|
//控制家里移开水缸后的电报机
|
|
|
|
public BoxCollider2D m_Collider;
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
m_Collider = GetComponent<BoxCollider2D>();
|
|
|
|
m_Collider.enabled = false;
|
|
|
|
}
|
|
|
|
public override void OnCall()
|
|
|
|
{
|
|
|
|
//交互后,改变玩家形象
|
|
|
|
FindObjectOfType<M_Player>().transform.Find("包").gameObject.SetActive(true);
|
|
|
|
FindObjectOfType<M_Player>().transform.Find("包带").gameObject.SetActive(true);
|
2021-09-10 22:17:49 +08:00
|
|
|
//播放穿上行囊的音效
|
|
|
|
GetComponent<AudioSource>().Play();
|
2021-08-28 00:49:37 +08:00
|
|
|
|
2021-09-10 22:17:49 +08:00
|
|
|
//随后删除自己(不要删!不然音效放不出来,我们直接关闭这个物体的碰撞体和图片就可以了)
|
2021-08-28 00:49:37 +08:00
|
|
|
FindObjectOfType<M_Player>().catched = null;
|
2021-09-10 22:17:49 +08:00
|
|
|
// Destroy(gameObject);
|
|
|
|
GetComponent<BoxCollider2D>().enabled = false;
|
|
|
|
GetComponent<SpriteRenderer>().enabled = false;
|
2021-08-28 00:49:37 +08:00
|
|
|
}
|
|
|
|
}
|