47 lines
1.0 KiB
C#
47 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Stone : Interacter
|
|
{
|
|
public StoneAxe axe;
|
|
public float interactTime = 1f;
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public override void OnCall()
|
|
{
|
|
base.OnCall();
|
|
switch (interactState) {
|
|
case 0:
|
|
ChangesDuringIntertacting(interactTime);
|
|
if (player.weapon.name == "石刀")
|
|
{
|
|
player.StoneInteractAnim();//播动画
|
|
Debug.Log("玩家制作石斧头动画");
|
|
Invoke(nameof(ChangeWeapon), interactTime);//配合动画延迟换武器
|
|
}
|
|
else {
|
|
Debug.Log("拿错物品");
|
|
interactState = 0;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void ChangeWeapon()
|
|
{
|
|
ItemController.Instance.ReplaceItem(axe);
|
|
}
|
|
|
|
}
|