Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Enemy") && ActiveHand != null)
        {
            if (pose == null)
            {
                pose = ActiveHand.GetComponent <SteamVR_Behaviour_Pose>();
            }
            float velocity = Mathf.Abs(pose.GetVelocity().x + pose.GetVelocity().y + pose.GetVelocity().z);

            //if(hardestVelocityYet < velocity)
            //{
            //    hardestVelocityYet = velocity;
            //    Debug.Log("Hardest Velocity updated to: " + hardestVelocityYet);
            //}

            //if (weakestVelocityYet > velocity)
            //{
            //    weakestVelocityYet = velocity;
            //    Debug.Log("Weakest Velocity updated to: " + weakestVelocityYet);
            //}

            ActiveHand.Vibrate(ActiveHand.vibrationValues.weaponHit, velocity, 6);

            if (velocity < 1)
            {
                velocity = 1;
            }
            int dmg = (int)velocity * damagePerForce;
            other.GetComponent <EnemyHealth>()?.TakeDamage(dmg);
        }
    }
Esempio n. 2
0
        // splits the active hand to two new hands
        public void Split(Card card1, Card card2)
        {
            Hand[] split_hands = ActiveHand.Split(card1, card2);

            hands.Add(split_hands[0]);
            hands.Add(split_hands[1]);
        }
Esempio n. 3
0
 public WaitForSecondsOrInput(ActiveHand activeHand, float numSeconds, Controls controls, Action <bool> result)
 {
     startTime       = Time.time;
     this.numSeconds = numSeconds;
     this.controls   = controls;
     this.activeHand = activeHand;
     Result          = result;
 }
    public Transform GetWeaponInHand(ActiveHand activeHand)
    {
        if (activeHand == ActiveHand.Left)
        {
            return(WeaponLeftPivot.transform);
        }

        return(WeaponRightPivot.transform);
    }
Esempio n. 5
0
 public void ReturnToPool(bool skipRemoveFromList = false)
 {
     ExecuteParticle();
     AudioManager.GetInstance().PlaySoundAtPosition(despawnClip, transform);
     if (ActiveHand)
     {
         ActiveHand.Drop();
     }
     if (Placement)
     {
         Placement.RemovePlacedObject();
     }
     PoolManager.ReturnOrnament(this, skipRemoveFromList);
 }
Esempio n. 6
0
    private void ExecuteMove(Move move)
    {
        EndLagTimeLeft = move.EndLag;
        if (DebugLog)
        {
            Debug.Log(move.name);
        }

        // Do the move stuff!
        move.ActivateHitbox(gameObject.tag, Mech.GetWeaponInHand(activeHand), move.HitBoxPosition);
        UpdateStance(move.EndStance);

        //Block weapon usage for a short while afterwards
        StartCoroutine(PostWeaponTime(move.moveTime, move.EndLag));

        moveIndex++;
        lastActiveHand = activeHand;
    }
Esempio n. 7
0
 private void OnDestroy()
 {
     //Debug.Log("On Destroy");
     //if (isQuitting) throw new System.Exception("Test");
     IsBeingDestroyed = true;
     if (ActiveHand != null)
     {
         ActiveHand.Drop();
     }
     if (!isQuitting)
     {
         ExecuteParticle();
         if (audioManager)
         {
             audioManager.PlaySoundAtPosition(despawnClip, transform);
         }
     }
 }
Esempio n. 8
0
    private void Update()
    {
        endLagUI.localScale = new Vector3(ExtensionMethods.Remap(EndLagTimeLeft, 0, 4, 0, 1), 1, 1);

        if (Game.controls.GetButtonDown("Left Weapon") || Game.controls.GetButtonDown("Right Weapon"))
        {
            if (InputLag)
            {
                //Debug.Log("Can't attack during end lag!");
                return;
            }

            if (Game.controls.GetButtonDown("Left Weapon"))
            {
                activeHand = ActiveHand.Left;
            }
            else if (Game.controls.GetButtonDown("Right Weapon"))
            {
                activeHand = ActiveHand.Right;
            }

            if (lastStance != CurrentStance)
            {
                moveIndex = 0;
                //Debug.Log("Stance changed");
            }

            if (activeHand != lastActiveHand)
            {
                moveIndex = 0;
                //Debug.Log("Hand Changed");
            }

            Move move = null;
            switch (CurrentStance)
            {
            case Stance.Idle:
                if (mainWeapons[(int)activeHand].IdleMoves.Count <= moveIndex)
                {
                    moveIndex = 0;
                }
                move = mainWeapons[(int)activeHand].IdleMoves[moveIndex];
                if (CanDual(mainWeapons[0].IdleMoves[moveIndex], mainWeapons[1].IdleMoves[moveIndex]))
                {
                    //Sets move to be dualmove if the other move is used in time
                    if (!dualPerformed)
                    {
                        dualPerformed = true;
                        StartCoroutine(GetSecondInput(move, DualTime, Game.controls));
                    }
                }

                break;

            case Stance.Forward:
                move = mainWeapons[(int)activeHand].ForwardMoves[moveIndex];
                if (CanDual(mainWeapons[0].ForwardMoves[moveIndex], mainWeapons[1].ForwardMoves[moveIndex]))
                {
                    //Sets move to be dualmove if the other move is used in time
                    if (!dualPerformed)
                    {
                        dualPerformed = true;
                        StartCoroutine(GetSecondInput(move, DualTime, Game.controls));
                    }
                }

                break;

            case Stance.Finisher:
                move = mainWeapons[(int)activeHand].FinisherMoves[moveIndex];
                if (CanDual(mainWeapons[0].FinisherMoves[moveIndex], mainWeapons[1].FinisherMoves[moveIndex]))
                {
                    //Sets move to be dualmove if the other move is used in time
                    if (!dualPerformed)
                    {
                        dualPerformed = true;
                        StartCoroutine(GetSecondInput(move, DualTime, Game.controls));
                    }
                }

                break;

            case Stance.High:
                move = mainWeapons[(int)activeHand].HighMoves[moveIndex];
                if (CanDual(mainWeapons[0].HighMoves[moveIndex], mainWeapons[1].HighMoves[moveIndex]))
                {
                    //Sets move to be dualmove if the other move is used in time
                    if (!dualPerformed)
                    {
                        dualPerformed = true;
                        StartCoroutine(GetSecondInput(move, DualTime, Game.controls));
                    }
                }

                break;

            case Stance.Low:
                move = mainWeapons[(int)activeHand].LowMoves[moveIndex];
                if (CanDual(mainWeapons[0].LowMoves[moveIndex], mainWeapons[1].LowMoves[moveIndex]))
                {
                    //Sets move to be dualmove if the other move is used in time
                    if (!dualPerformed)
                    {
                        dualPerformed = true;
                        StartCoroutine(GetSecondInput(move, DualTime, Game.controls));
                    }
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    }
Esempio n. 9
0
 private void displayMenu(ActiveHand a = ActiveHand.Normal)
 {
     Console.WriteLine("\n\n"+
                       "     What would you like to do?{0}\n", HasSplit ? ""
                                                                        : a == ActiveHand.Normal ? " (Hand 1)"
                                                                                                 : " (Hand 2)");
     Console.WriteLine(" [1] Hit");
     Console.WriteLine(" [2] Stand");
     if (CanSplit) {
         Console.WriteLine(" [3] Split");
     }
     Console.WriteLine(" [0] Quit Game");
 }