121 lines
2.8 KiB
C#
121 lines
2.8 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Unity.VisualScripting;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UIElements;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public class SmallBullet : Bullet
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
switch (this.bulletMoveType)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ƶ<EFBFBD>
|
|||
|
case BulletMoveType.PeerToPeer:
|
|||
|
if (IsMove)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
case BulletMoveType.PointToDirection:
|
|||
|
break;
|
|||
|
case BulletMoveType.Scope:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void OnTriggerEnter2D(Collider2D collision)
|
|||
|
{
|
|||
|
Role Crole = collision.gameObject.GetComponent<Role>();
|
|||
|
if (Crole)
|
|||
|
{
|
|||
|
if (Crole.camp != role.camp)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
foreach (var buff in role.storageBuff)
|
|||
|
{
|
|||
|
if (!Crole.PlayerBuff.Contains(buff))
|
|||
|
{
|
|||
|
Crole.PlayerBuff.Add(buff);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Crole.ApplyBuffs();
|
|||
|
|
|||
|
// Debug.Log(this.role.gameObject.name + "<22><><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
int direction = 0;
|
|||
|
if (collision.transform.position.x > transform.position.x) //<2F>ӵ<EFBFBD><D3B5><EFBFBD><F2B5BDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ұ<EFBFBD>
|
|||
|
{
|
|||
|
direction = 1;
|
|||
|
}
|
|||
|
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
|
|||
|
|
|||
|
|
|||
|
if (myBulletType != BulletType.Spraying)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
if (animator == null)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
Destroy(this.gameObject);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
IsMove = false; //ֹͣ<CDA3>ƶ<EFBFBD>
|
|||
|
Collider2D.enabled = false; //<2F>ر<EFBFBD><D8B1><EFBFBD>ײ<EFBFBD><D7B2>
|
|||
|
transform.position = collision.transform.position;
|
|||
|
animator.SetTrigger("Boom");
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void OnTriggerStay2D(Collider2D collision)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void OnTriggerExit2D(Collider2D collision)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|