65 lines
1.4 KiB
C#
65 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class PetObject : MonoBehaviour
|
|
{
|
|
//物体形状
|
|
public SpriteRenderer petSprite;
|
|
//消除特效预设体
|
|
public GameObject delEff;
|
|
//高亮预设体
|
|
public GameObject higLightEff;
|
|
//消除音效组件
|
|
//private AudioSource soundAudioSource;
|
|
|
|
//是否高亮
|
|
[HideInInspector]
|
|
public bool isHightLight;
|
|
|
|
//高亮特效
|
|
private GameObject effLight;
|
|
private GameObject effDelet;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
//创建高亮特效
|
|
public void CreatHightLight()
|
|
{
|
|
isHightLight = true;
|
|
effLight = Instantiate(higLightEff, this.transform.position, higLightEff.transform.rotation);
|
|
effLight.transform.SetParent(this.transform);
|
|
}
|
|
//创建删除特效
|
|
public void CreatDelEff()
|
|
{
|
|
effDelet = Instantiate(delEff, this.transform.position, Quaternion.identity);
|
|
effDelet.transform.SetParent(this.transform);
|
|
}
|
|
|
|
//删除高亮特效
|
|
public void DeleteHightLight()
|
|
{
|
|
isHightLight = false;
|
|
if (effLight!=null)
|
|
{
|
|
Destroy(effLight.gameObject);
|
|
}
|
|
}
|
|
//关闭萌宠图片
|
|
public void CloseSpirte()
|
|
{
|
|
petSprite.sprite = null;
|
|
}
|
|
|
|
}
|