Beispiel #1
0
        public void Init(ParticleEventProperties properties, Animator animator, float startTime, bool flipped, float stopTime, bool clear)
        {
            _properties = properties;
            //_flipped      = flipped;
            _clear = clear;
            //_animator         = animator;
            _startTime = startTime;
            _stopTime  = stopTime;
            _lastTime  = startTime;
            _played    = false;
            _stopped   = false;

            if (_particleSystem == null)
            {
                _particleSystem = MoveUtils.InstantiateParticle(null, properties, animator, flipped, true);
            }

            if (properties._parent)
            {
                _attachTransform = _particleSystem.GetComponent <AttachTransform>();
                if (_attachTransform != null)
                {
                    _attachTransform.UpdateManually = true;
                }
            }

            Reset();
        }
Beispiel #2
0
        private ParticleSystem InstantiateParticle(ParticleEventProperties properties, bool flipped, bool target = false, Vector3 tarPos = new Vector3(), Animator tarAimator = null, Vector3 tarOrgPos = new Vector3(), Vector3 tarHitPos = new Vector3())
        {
            ParticleSystem ps = null;

            if (properties._spawnAtOpponent && _player != null)
            {
                // calculate world position of the particle
                //Vector3 position = _player.transform.position;
                //Combatant target = _player.GetAttackTarget();

                Vector3 position = this.gameObject.transform.position;

                if (!target)
                {
                    ps = MoveUtils.InstantiateParticle(this, properties, position, flipped);
                }
                else
                {
                    //position = target.transform.position;
                    position = tarPos;
                    if (properties._attachToOpponent)
                    {
                        flipped = !flipped;                             // since this is now attached to the other player we need to reverse the flip

                        if (tarAimator == null)
                        {
                            ps = MoveUtils.InstantiateParticle(this, properties, position, flipped);
                        }
                        else
                        {
                            ps = MoveUtils.InstantiateParticle(this, properties, tarAimator, flipped);
                        }
                    }
                    else
                    {
                        if (properties._spawnAtTargetBase)
                        {
                            position = tarOrgPos;
                        }
                        else if (properties._spawnAtHitPoint)
                        {
                            position = tarHitPos;
                        }

                        ps = MoveUtils.InstantiateParticle(this, properties, position, flipped);
                    }
                }
            }
            else
            {
                if (_animator == null)
                {
                    ps = MoveUtils.InstantiateParticle(this, properties, transform.position, flipped);
                }
                else
                {
                    ps = MoveUtils.InstantiateParticle(this, properties, _animator, flipped);
                }
            }

            return(ps);
        }