关于 public interface{} 接口的设置

阅读 48

2022-04-25

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// 所有子弹的接口。
/// </summary>
public interface Test
{
    void SetDamage(int damage);
    int GetDamage();
    void Fire(Transform target);
}

public class Testtttttttt : MonoBehaviour, Test
{

Transform target;

    int damage = 1;
    public void Fire(Transform target)
    {
        this.target = target;
    }

    public int GetDamage()
    {
        return damage;
    }

    public void SetDamage(int damage)
    {
        this.damage = damage;
    }

}

精彩评论(0)

0 0 举报