示例#1
0
        public void Initialize(Player player, PersonProvider provider)
        {
            this.player   = player;
            this.provider = provider;
            var col = GetComponent <CircleCollider2D>();

            collider       = col.GetComponent <Collider2D>();
            render         = GetComponent <SpriteRenderer>();
            radius         = col.radius;
            col.enabled    = false;
            mitsuCount     = provider.MitsuCount;
            safeTime       = provider.KillTime;
            restExecteTime = provider.KillTime;

            provider.OnPause
            .Subscribe(x =>
            {
                if (x)
                {
                    audioSource.Pause();
                }
                else
                {
                    audioSource.UnPause();
                }
            }).AddTo(gameObject);
        }
示例#2
0
        public override void Initialize(PersonProvider provider)
        {
            base.Initialize(provider);
            this.provider = provider;
            killSelfTime  = provider.KillTime;
            InMitsu.Subscribe(x =>
            {
                if (!x)
                {
                    currentVelocityBonus = velocityDefaultE;
                    direction.Value      = new Vector2(Random.Range(-1, 1), Random.Range(-1, 1));
                }
            }).AddTo(gameObject);

            direction
            .Select(x => x * currentVelocityBonus)
            .Subscribe(dir => rb2D.velocity = dir).AddTo(gameObject);

            DiedAsync.First().Subscribe(async _ =>
            {
                anim.Play("Die");
                provider.people.Remove(this);
                await UniTask.Delay(System.TimeSpan.FromMilliseconds(1100));
                Destroy(gameObject);
            },
                                        () =>
            {
            }).AddTo(gameObject);

            transform.ObserveEveryValueChanged(t => t.position)
            .Where(p => p.x > 32 || p.x < -32 || p.y > 24 || p.y < -24)
            .Subscribe(_ =>
            {
                // エリアから出たら、原点(0. 0)あたりにもどる
                var pos         = new Vector2(Random.Range(-20, 20), Random.Range(-10, 10));
                direction.Value = (pos - (Vector2)transform.position).normalized;
            }).AddTo(gameObject);

            isCatastorophy.Where(x => x).Subscribe(_ => transform.DOLocalMove(Vector3.zero, 10)).AddTo(gameObject);
        }
示例#3
0
 public virtual void Initialize(PersonProvider provider)
 {
     socialDistance = provider.SocialDistance;
     mitsuCount     = provider.MitsuCount;
 }
示例#4
0
 private void Awake()
 {
     provider          = GetComponent <PersonProvider>();
     tutrialController = GetComponent <TutrialController>();
 }