123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using UnityEngine;
- public class LocalWind : MonoBehaviour, IBlowee, ILevelItem
- {
- protected virtual void Start()
- {
- }
- public virtual Vector2 GetDir(IBlowable blowable, Vector2 pos)
- {
- return Vector2.zero;
- }
- public virtual float GetPower(IBlowable blowable, Vector2 pos)
- {
- return this.power;
- }
- public virtual float GetMaxAccelSqr()
- {
- return 0f;
- }
- public virtual void ParserIntegrator(Integrator integrator)
- {
- }
- public virtual GameObject GetGO()
- {
- return base.gameObject;
- }
- public virtual bool SelfFilter()
- {
- return false;
- }
- private void OnTriggerEnter2D(Collider2D other)
- {
- if (this.SelfFilter())
- {
- return;
- }
- if (this.filteredTags.Length > 0)
- {
- foreach (string tag in this.filteredTags)
- {
- if (other.CompareTag(tag))
- {
- return;
- }
- }
- }
- Component component = other.GetComponent(typeof(IBlowable));
- if (component != null)
- {
- IBlowable blowable = (IBlowable)component;
- blowable._OnWindEnter(this);
- }
- }
- private void OnTriggerExit2D(Collider2D other)
- {
- if (this.SelfFilter())
- {
- return;
- }
- if (this.filteredTags.Length > 0)
- {
- foreach (string tag in this.filteredTags)
- {
- if (other.CompareTag(tag))
- {
- return;
- }
- }
- }
- Component component = other.GetComponent(typeof(IBlowable));
- if (component != null)
- {
- IBlowable blowable = (IBlowable)component;
- blowable._OnWindExit(this);
- }
- }
- public virtual void OnReset()
- {
- }
- public virtual void OnPause(bool isPause)
- {
- }
- public virtual void OnEntertBlock(ILevelBlock block)
- {
- }
- public virtual void OnLeaveBlock(ILevelBlock block)
- {
- }
- public virtual void OnPickingTime(float time)
- {
- }
- public float power;
- public string[] filteredTags;
- public float maxHeroYSpeed;
- public float minHeroYSpeed;
- }
|