Roman 65237ef698 Squashed commit of the following:
commit 0d7446d2e7a625f033cda6acc496c6cddfe2d75f
Author: SAIPO <grasste0403@hotmail.com>
Date:   Sat Dec 25 22:53:32 2021 +0800

    修改建议及完善特效

    修改建议:
    1.添加了击中的粒子特效,但是还需要迭代
    2.修复马死后灰尘不会消失的bug

    完善特效
    1.制作了死亡时的阴间特效,已经在全场景实装
    2.制作了闪电的辉光特效。
    3.调整了所有场景的全局shader以适配死亡阴间特效

# Conflicts:
#	UserSettings/EditorUserSettings.asset
2021-12-26 21:25:59 +08:00

28 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 锤子类,主要判定下攻击
/// </summary>
public class Hammer : MonoBehaviour
{
public ParticleSystem attackParticleSystem;
//当有东西进入触发器
public void OnTriggerEnter2D(Collider2D other){
//看看是不是敌人,再看下它此时能不能被打
if (other.TryGetComponent<Enemy>(out Enemy enemy) && enemy.canBeHit && !other.isTrigger){
enemy.OnBeHit(MyPlayer.AtkMethod.,
(enemy.transform.position.x -
transform.position.x > 0) ? -1 : 1);
//击中后调用粒子
attackParticleSystem.Play();
//击中成功后中幅度震动一下手柄
StartCoroutine(FindObjectOfType<VibrationManager>().ShakePad(0.5f,0.3f,0.2f,VibrationManager.PadShakeitem.));
// //再触发一下子弹时间
// FindObjectOfType<VibrationManager>().TimeSlow();
}
}
}