EffectOptionBehavior.cs 769 B

12345678910111213141516171819202122232425262728293031323334
  1. using UnityEngine;
  2. using System.Collections;
  3. public class EffectOptionBehavior : MonoBehaviour
  4. {
  5. public Effect Effect { get; set; }
  6. EffectOption mOption;
  7. void Start()
  8. {
  9. mOption = GetComponent<EffectOption> ();
  10. }
  11. void OnDisable()
  12. {
  13. Effect = null;
  14. }
  15. void Update()
  16. {
  17. if (Effect != null && mOption != null) {
  18. if (mOption.forceGround)
  19. UpdateGround ();
  20. }
  21. }
  22. void UpdateGround()
  23. {
  24. if (Effect.FollowType == EffectFollowType.Effect_Follow_Self && Effect.OwnerFighter != null)
  25. transform.position = transform.position.SetY (Effect.OwnerFighter.FloorY);
  26. else if (Effect.FollowType == EffectFollowType.Effect_Follow_Target && Effect.TargetFighter != null)
  27. transform.position = transform.position.SetY (Effect.TargetFighter.FloorY);
  28. }
  29. }