예제 #1
0
        protected void Return(T ret)
        {
            Returned.Invoke(this, new ReturnControlReturnedEventArgs <T>(ret));

            if (SelfDispose)
            {
                Dispose();
            }
        }
예제 #2
0
 public CustomEntry()
 {
     InitializeComponent();
     ReturnCommand = new Command(() =>
     {
         Returned?.Invoke(this, new EntryEventArgs(Name));
     });
     PwEntry.Focused += (sender, e) => AnimateError(false);
     BindingContext   = this;
 }
        public override void Update(GameTime gameTime, KeyboardState keyboardState, Character owner)
        {
            var crossedReturningPoint = false;

            if (IsDestroyed.Equals(false))
            {
                if (IsReturned.Equals(false))
                {
                    Duration += 0.1f;
                    if (IsReturning.Equals(false))
                    {
                        Position += new Vector2(Trajectory.X * ProjectileSpeed, (2.5f - (Duration * 1.5f)));
                        if (Duration > 3f)
                        {
                            IsReturning     = true;
                            ProjectileSpeed = 2.5f;
                        }
                        else
                        {
                            ProjectileSpeed += 0.1f;
                        }
                    }
                    else
                    {
                        var direction = owner.Position - Position;
                        direction.Normalize();
                        Position += direction * (ProjectileSpeed * 2);
                        if (Hitbox.Intersects(owner.Hitbox))
                        {
                            crossedReturningPoint = true;
                        }
                        if (IsReturning.Equals(true) && crossedReturningPoint.Equals(true))
                        {
                            Console.WriteLine("Hammer returned to initial position");
                            Duration    = 0.0f;
                            IsReturned  = true;
                            IsReturning = false;
                            Returned?.Invoke(this, new EventArgs());
                        }
                    }

                    foreach (var ent in Entities)
                    {
                        if (Hitbox.Intersects(ent.Hitbox) && ent.IsDamaged.Equals(false))
                        {
                            ent.TakeDamage();
                        }
                    }
                }
            }
        }
예제 #4
0
        public override void Update(bool[] pressed)
        {
            select.Update();
            select.Position = new Vector2(selects[(int)pausetype].Position.X - 4, selects[(int)pausetype].Position.Y - 4);

            if (pressed[(int)ButtonType.Up])
            {
                ChangePauseType(-1);
                Sound.Play(soundfilenames[0], -1000);
            }
            else if (pressed[(int)ButtonType.Down])
            {
                ChangePauseType(1);
                Sound.Play(soundfilenames[0], -1000);
            }
            else if (pressed[(int)ButtonType.Cross] || pressed[(int)ButtonType.Start])
            {
                if (Resumed != null)
                {
                    Resumed.Invoke(this, EventArgs.Empty);
                }
            }
            else if (pressed[(int)ButtonType.Circle])
            {
                if (pausetype == PauseType.Resume)
                {
                    if (Resumed != null)
                    {
                        Resumed.Invoke(this, EventArgs.Empty);
                    }
                }
                else if (pausetype == PauseType.Retry)
                {
                    if (Retryed != null)
                    {
                        Retryed.Invoke(this, EventArgs.Empty);
                    }
                }
                else if (pausetype == PauseType.Return)
                {
                    if (Returned != null)
                    {
                        Returned.Invoke(this, EventArgs.Empty);
                    }
                }
            }
        }
예제 #5
0
 public override void Update(InputInfoBase inputInfo)
 {
     if (Disposed)
     {
         return;
     }
     if (inputInfo.IsPressed(ButtonType.Up))
     {
         ChangePauseType(-1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Down))
     {
         ChangePauseType(1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Cross) || inputInfo.IsPressed(ButtonType.Start))
     {
         // 再開
         if (Resumed != null)
         {
             Resumed.Invoke(this, EventArgs.Empty);
         }
     }
     else if (inputInfo.IsPressed(ButtonType.Circle))
     {
         // 再開
         if (pausetype == PauseType.Resume)
         {
             if (Resumed != null)
             {
                 Resumed.Invoke(this, EventArgs.Empty);
             }
         }
         // リターン
         else if (pausetype == PauseType.Return)
         {
             if (Returned != null)
             {
                 Returned.Invoke(this, EventArgs.Empty);
             }
         }
     }
     base.Update();
 }
예제 #6
0
    public void Interact()
    {
        // Player's Animation State Change
        // Lightbulb GameObject destroyed

        PlayerMovement player = FindObjectOfType <PlayerMovement>();
        Transform      lightbulb;

        if (player == null)
        {
            return;
        }

        if (noLightbulb)
        {
            lightbulb = player.transform.GetChild(0).GetChild(0);
            lightbulb.SetParent(transform);
            lightbulb.SetAsFirstSibling();
            lightbulb.localPosition = Vector3.zero;
            lightbulb.localRotation = Quaternion.identity;
            lightbulb.localScale    = Vector3.one;
            noLightbulb             = false;

            Returned?.Invoke();
        }
        else
        {
            lightbulb = transform.GetChild(0);
            lightbulb.SetParent(player.transform.GetChild(0));
            lightbulb.localPosition = Vector3.zero;
            lightbulb.localRotation = Quaternion.identity;
            lightbulb.localScale    = Vector3.one;
            noLightbulb             = true;

            Removed?.Invoke();
        }
    }
예제 #7
0
 public CustomInput()
 {
     InitializeComponent();
     ReturnCommand  = new Command(() => Returned?.Invoke(this, new EntryEventArgs(Name)));
     BindingContext = this;
 }
예제 #8
0
 public void Return() => Returned?.Invoke(this);
예제 #9
0
 private void OnReturned(BrokerReturnedEventArgs e)
 {
     Returned?.Invoke(this, e);
 }
예제 #10
0
 protected void OnReturn()
 {
     Returned?.Invoke(this, EventArgs.Empty);
 }