| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class WavePowerSkill : MonoBehaviour
- {
- public Vector3 force;
- private int fx = 1;
- private Vector3 curForce;
- public int damage;
- public float continueTime;
- public int cacheID;
- public PlayerController pc;
- private void Update()
- {
- continueTime -= Time.deltaTime;
- if (continueTime <= 0)
- {
- pc.conductCanRelease[cacheID] = true;
- gameObject.SetActive(false);
- }
- }
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.layer == 8)
- {
- if (other.gameObject.transform.position.x >= transform.position.x)
- {
- fx = 1;
- }
- else
- {
- fx = -1;
- }
- curForce = force;
- curForce.x = curForce.x * fx;
- other.GetComponentInParent<Enemy>().ChangeState(CharacterState.Weak);
- other.GetComponentInParent<Enemy>().wallDamage = damage;
- other.GetComponentInParent<Rigidbody>().AddForce(curForce);
- }
- }
- }
|