コード例 #1
0
 public void AttackWithCatapult()
 {
     catapult.Fire();
     turnsPassed += 1;
     onTurnFinished();
     Debug.Log("Used Attack with catapult");
 }
コード例 #2
0
 public void elegirAccion()
 {
     if (Input.GetKeyDown(KeyCode.W))
     {
         catapult.Fire();
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         rayBeam.Fire();
     }
 }
コード例 #3
0
ファイル: Human.cs プロジェクト: rejurime/MonoGame-Samples
        /// <summary>
        /// Function processes the user input
        /// </summary>
        /// <param name="gestureSample"></param>
        public void HandleInput(GestureSample gestureSample)
        {
            // Process input only if in Human's turn
            if (IsActive)
            {
                // Process any Drag gesture
                if (gestureSample.GestureType == GestureType.FreeDrag)
                {
                    // If drag just began save the sample for future
                    // calculations and start Aim "animation"
                    if (null == firstSample)
                    {
                        firstSample           = gestureSample;
                        Catapult.CurrentState = CatapultState.Aiming;
                    }

                    // save the current gesture sample
                    prevSample = gestureSample;

                    // calculate the delta between first sample and current
                    // sample to present visual sound on screen
                    Vector2 delta = prevSample.Value.Position - firstSample.Value.Position;
                    Catapult.ShotStrength = delta.Length() / maxDragDelta;
                    float baseScale = 0.001f;
                    arrowScale = baseScale * delta.Length();
                    isDragging = true;
                }
                else if (gestureSample.GestureType == GestureType.DragComplete)
                {
                    // calc velocity based on delta between first and last
                    // gesture samples
                    if (null != firstSample)
                    {
                        Vector2 delta = prevSample.Value.Position - firstSample.Value.Position;
                        Catapult.ShotVelocity = MinShotStrength + Catapult.ShotStrength *
                                                (MaxShotStrength - MinShotStrength);
                        Catapult.Fire(Catapult.ShotVelocity);
                        Catapult.CurrentState = CatapultState.Firing;
                    }

                    // turn off dragging state
                    ResetDragState();
                }
            }
        }
コード例 #4
0
 public void AttackWithCatapult()
 {
     Debug.Log("Used Attack with catapult");
     catapult.Fire();
     canAttack = false;
 }
コード例 #5
0
 public void AttackWithCatapult()
 {
     catapult.Fire();
 }
コード例 #6
0
 public void AttackWithCatapult()
 {
     catapult.Fire();
     Debug.Log("Used Attack with catapult");
 }