Exemplo n.º 1
0
 public void Init(float startTime, MoveEditor.ProjectileEventInfo info, GameObject previewObject, GameObject previewHitObject, bool flipped)
 {
     _startTime              = startTime;
     _projectileEventInfo    = info;
     _previewCharacterObject = previewObject;
     _filpped          = flipped;
     _previewHitObject = previewHitObject;
 }
Exemplo n.º 2
0
    public void Activate(GameObject owner, MoveEditor.ProjectileEventInfo projectileEventInfo, OnProjectileDeactivated callback)
    {
        _owner = owner.GetMonoILRComponent <DynamicMonoILRObject>();

        AttributeData attr = _owner.OnGetAttributeData("GetAnimator");

        if (_fxHelper != null)
        {
            //_fxHelper.Init(owner);
        }

        if (owner != null)
        {
            Activate(attr.Animator, projectileEventInfo, callback, false); //owner.ID == 1 );
        }
        else
        {
            EB.Debug.LogWarning("Failed to activate projectile!");
        }
    }
Exemplo n.º 3
0
    public void Activate(Animator ownerAnimator, MoveEditor.ProjectileEventInfo projectileEventInfo, OnProjectileDeactivated callback, bool flipped)
    {
        _projectileEventInfo = projectileEventInfo;
        _deactivateCallback  = callback;
        MoveEditor.ProjectileEventProperties projectileProperties = projectileEventInfo._projectileProperties;

        Transform spawnTransform = MoveEditor.MoveUtils.GetBodyPartTransform(ownerAnimator, projectileProperties._spawnAttachment, projectileProperties._spawnAttachmentPath);

        _speed = projectileProperties._initialVelocity;

        transform.parent        = spawnTransform;
        transform.localPosition = projectileProperties._spawnOffset;

        if (projectileProperties._worldSpace)
        {
            transform.eulerAngles = projectileProperties._spawnAngles;

            if (flipped)
            {
                // rotate this by 180
                transform.RotateAround(transform.position, Vector3.up, 180.0f);
            }
        }
        else
        {
            transform.localEulerAngles = projectileProperties._spawnAngles;
        }

        // mirror the effect, for parented effects, this is done inside the attach transform
        if (flipped)
        {
            transform.rotation = FlipRotation(transform.rotation);
        }

        transform.parent     = null;
        transform.localScale = Vector3.one;

        // play all on spawn events
        PlayEffects(_onSpawnEvents);

        //_previousPosition = transform.position;

        _state = ProjectileState.kSpwaned;

        #region [GM] Projectile.
        if (_projectileEventInfo._projectileProperties._autoVelocity)
        {
            CalculateAutoVelocity();
            _state = ProjectileState.kSpwaned;             // don't displace on kSpwaned (will go to kActive on next frame)
        }
        #endregion

        _startTime = Time.realtimeSinceStartup;
        _duration  = 1.0f;
        if (_owner != null)
        {
            AttributeData attr     = _owner.OnGetAttributeData("GetTargetPosition");
            float         distance = Vector3.Distance(GetCenter(), attr.TargetPosition);
            _duration = distance / _speed;
        }
    }