using DG.Tweening; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Shu : Interacter { Animator anim; public float rotateDuration=0.5f; SpriteRenderer m_spr; public Sprite sprite_Mu; public Item Stick1; public Item Stick2; override protected void Start() { base.Start(); m_spr = GetComponent(); anim = GetComponent(); } // Update is called once per frame void Update() { } public override void OnCall() { switch (interactState) { //交互的第一阶段,掉落树枝 case 0: ChangesDuringIntertacting(1f); //树抖两下 anim.SetTrigger("Shake"); ItemController.Instance.AddItem(Stick1); ItemController.Instance.AddItem(Stick2); //ItemController.Instance.ToLastestItem(); break; //交互的第二阶段,推倒树木 case 1: ChangesDuringIntertacting(rotateDuration); player.TreeInteractAnim(); anim.SetTrigger("Fall"); UIWord.Instance.WoodUI(); //transform.DORotate(new Vector3(0, 0, -90), rotateDuration); break; default: break; } } override protected void ChangesDuringIntertacting(float time) { base.ChangesDuringIntertacting(time); } public override void CancleEvent() { player.ToMap("Normal"); } }