public void Run()
        {
            var world = Origin.GetWorld();
            var sword = new BehaviorSword(Origin, 3);

            Behavior.Apply(sword);
            sword.SetScale(1, LerpHelper.QuadraticOut, this);
            var star = new BigStar(world, SpriteLoader.Instance.AddSprite("content/effect_star_big"));

            star.Angle.Set(0, MathHelper.TwoPi, LerpHelper.QuadraticOut, 30);
            star.Scale.Set(0, 0.1f, LerpHelper.QuadraticOut, 30);
            star.ShouldDestroy.Set(true, LerpHelper.Linear, 30);
            var swordEffect = new SwordEffect(world, star, sword, 16)
            {
                DrawPass = DrawPass.EffectAdditive,
            };
        }
Example #2
0
    private void InitializeGrab()
    {
        if (grab == false && grabbedNode != null)
        {
            grabbedNode = null;
            rigidbody2D.isKinematic = false;
            SwordEffect.Stop();
        }
        if (grab == true && grabbedNode == null && nodeCollider.hits.Count > 0)
        {
            grabbedNode = nodeCollider.hits.First().Value;
            Vector2 grabTranslation = (Vector2)transform.position - grabbedNode.node.position;
            grabOffset = grabTranslation.magnitude;
            grabRotation = Quaternion.FromToRotation(grabbedNode.node.velocity, grabTranslation);
            rigidbody2D.isKinematic = true;

            SwordEffect.Play(grabbedNode, attackSpeed);
        }
    }
Example #3
0
 private void Awake()
 {
     instance = this;
     instance.swordSprite.enabled = false;
 }