| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Trans_Cook : MonoBehaviour
- {
- public PlayerController controller;
- public float changeTime;
- public Vector3 UIoffset; //UIµ÷ÕûÖµ
- private Demonic dem;
- public float intervalTime; //¹¥»÷Ó²Ö±
- private float pastAttackTime;
- private bool canAttack = true;
- private void Start()
- {
- controller = GetComponentInParent<PlayerController>();
- controller.changeTime = changeTime;
- controller.uiHp.transform.position += UIoffset;
- controller.uiMp.transform.position += UIoffset;
- dem = GetComponent<Demonic>();
- }
- private void OnDisable()
- {
- controller.uiHp.transform.position -= UIoffset;
- controller.uiMp.transform.position -= UIoffset;
- }
- private void Update()
- {
- if (!canAttack)
- {
- pastAttackTime += Time.deltaTime;
- if (pastAttackTime >= intervalTime)
- {
- canAttack = true;
- pastAttackTime = 0;
- }
- }
- if (controller.isinputJ && canAttack)
- {
- canAttack = false;
- controller.isinputJ = false;
- dem.Attack2();
- }
- if (controller.isinputK)
- {
- controller.isinputK = false;
- }
- if (controller.isinputL)
- {
- controller.isinputL = false;
- }
- }
- }
|