private void Awake()
 {
     _t      = GetComponent <Transform>();
     _body   = GetComponent <Rigidbody2D>();
     _effect = GetComponent <AntEffectSpawner>();
     _actor  = GetComponent <AntActor>();
     _actor.Stop();
 }
        public void Reset(AntEmitter aEmitter)
        {
            _sprite = (Preset.actor.useChildActor)
                                ? _particle.GameObject.GetComponentInChildren <SpriteRenderer>()
                                : _particle.GameObject.GetComponent <SpriteRenderer>();

            _actor = (Preset.actor.useChildActor)
                                ? _particle.GameObject.GetComponentInChildren <AntActor>()
                                : _particle.GameObject.GetComponent <AntActor>();

            _actor.timeScale = Preset.actor.timeScale + AntMath.RandomRangeFloat(Preset.actor.rndToTimeScale);
            _sprite.flipX    = (Preset.actor.rndFlipX)
                                ? (AntMath.RandomRangeInt(0, 1) == 1)
                                : Preset.actor.flipX;

            _sprite.flipY = (Preset.actor.rndFlipY)
                                ? (AntMath.RandomRangeInt(0, 1) == 1)
                                : Preset.actor.flipY;

            _actor.reverse   = Preset.actor.reverse;
            _actor.loop      = Preset.actor.loop;
            _actor.loopDelay = Preset.actor.loopDelay + AntMath.RandomRangeFloat(Preset.actor.rndToLoopDelay);

            if (Preset.actor.playAnimation)
            {
                if (Preset.actor.selectRandomFrame)
                {
                    _actor.PlayRandomFrame();
                }
                else
                {
                    _actor.GotoAndPlay(Preset.actor.startFrame);
                }
            }
            else
            {
                if (Preset.actor.selectRandomFrame)
                {
                    _actor.GotoAndStop(AntMath.RandomRangeInt(1, _actor.TotalFrames));
                }
                else
                {
                    _actor.GotoAndStop(Preset.actor.startFrame);
                }
            }

            IsActive = false;             // Выкл. обработку компонента.
        }
示例#3
0
        public override void OnAwake()
        {
            transform.localPosition = spawnPos;
            gameObject.name         = "Effect_" + 1;
            gameObject.SetActive(true);

            gameObj = objMgr.Get(data.name);
            gameObj.transform.SetParent(transform);
            gameObj.transform.localScale    = data.scale;
            gameObj.transform.localPosition = Vector3.zero;
            gameObj.SetActive(true);

            var spriteRender = gameObj.GetComponent <SpriteRenderer>();

            spriteRender.sortingOrder     = LayerMask.NameToLayer("Effect");
            spriteRender.sortingLayerName = "Effect";

            antActor           = gameObj.GetComponent <AntActor>();
            antActor.timeScale = 0.8f;
            antActor.EventAnimationComplete += OnCompleted;

            soundMgr.PlaySound("Sounds/" + data.sound);
        }
示例#4
0
 private void Awake()
 {
     _t      = GetComponent <Transform>();
     _actor  = GetComponent <AntActor>();
     _sprite = GetComponent <SpriteRenderer>();
 }
示例#5
0
 private void Awake()
 {
     _t     = GetComponent <Transform>();
     _actor = GetComponent <AntActor>();
     _actor.GotoAndStop(1);
 }
示例#6
0
 void OnCompleted(AntActor aActor, string aAnimationName)
 {
     this.OnDispose();
 }
 private void Awake()
 {
     _t      = GetComponent <Transform>();
     _actor  = GetComponent <AntActor>();
     _effect = GetComponent <AntEffectSpawner>();
 }
 public void Destroy()
 {
     _actor  = null;
     _sprite = null;
 }
 private void Awake()
 {
     _t     = GetComponent <Transform>();
     _actor = GetComponent <AntActor>();
 }