Ejemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    private void RunSuspenseTimer()
    {
        suspenseTimer += Time.deltaTime;

        if (suspenseTimer >= suspenseTime)
        {
            Showdown.GetInstance().StateMachine.TransitionToState(ShowdownState.ShowdownStateType.ShowdownFightState);
        }
    }
Ejemplo n.º 2
0
    private void RunResolveTimer()
    {
        resolveTimer += UnityEngine.Time.deltaTime;

        if (resolveTimer > 0.25)
        {
            Showdown.GetInstance().IsAcceptingAttacks = false;
            Showdown.GetInstance().DisplayWinner(Showdown.GetInstance().ProcessAttacks());

            Showdown.GetInstance().StateMachine.TransitionToState(ShowdownStateType.ShowdownInitState);
            //Destroy( Showdown.GetInstance() );
        }
    }
Ejemplo n.º 3
0
    public void GoShowdown()
    {
        if (currentState != GameState.Showdown)
        {
            player1.SetColor();
            player2.SetColor();

            setState("Showdown");
            Showdown temp = Instantiate(showdownPrefab);

            temp.showdownCamera = showdownCamera;
            temp.HUD            = HUD;
            temp.mainCamera     = Camera.main;

            Showdown.GetInstance().InitShowdown(player1, player2);
        }
    }
Ejemplo n.º 4
0
 private void TransitionToSuspense()
 {
     Debug.Log("TransitionToSuspense");
     Showdown.GetInstance().BeginShowdown();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Occurs when this state is entered from another state.
 /// </summary>
 public override void OnEnter()
 {
     base.OnEnter();
     suspenseTime = Random.Range(4.0f, 5.0f);
     Showdown.GetInstance().IsAcceptingAttacks = true;
 }
Ejemplo n.º 6
0
    /// <summary>
    /// Occurs when this state is entered from another state.
    /// </summary>
    public override void OnEnter()
    {
        base.OnEnter();

        Showdown.GetInstance().Fight();
    }
Ejemplo n.º 7
0
 /// <summary>
 /// Occurs everytime an update is called. (Once per frame in this instance)
 /// </summary>
 public virtual void Update()
 {
     Showdown.GetInstance().RunTimer();
 }
Ejemplo n.º 8
0
    // Update is called once per frame
    private void Update()
    {
        //   string[] meh = Input.GetJoystickNames();

        shieldCD -= Time.deltaTime;
        if (shielded == true)
        {
            shieldTimer -= Time.deltaTime;
            if (shieldTimer <= 0)
            {
                shielded    = false;
                shieldTimer = 0.8f;
            }
        }
        else
        {
            GetComponent <SpriteRenderer>().color = player.myColor;
        }

        if (Input.GetButtonDown("ShieldC" + player.id.ToString()) && shieldCD <= 0)
        {
            GetComponent <SpriteRenderer>().color = Color.yellow;

            Shield.CrossFadeAlpha(0.0f, 0.0f, true);
            shielded = true;
            shieldCD = 7.0f;
            Shield.CrossFadeAlpha(1.0f, shieldCD, false);
        }

        if (GameObject.Find("GameManager").GetComponent <GameManager>().currentState == GameManager.GameState.Showdown)
        {
            if (Input.GetButtonDown("ShowdownButton" + player.id))
            {
                Showdown.GetInstance().ExecuteAttack(player);
            }
            //if (Input.GetAxisRaw("ShowdownButton") == 1 && player.id == 1)
            //    Showdown.GetInstance().ExecuteAttack(player);
        }
        else
        {
            blinkCD -= Time.deltaTime;

            float playerVelocityX = 0, playerVelocityY = 0;
            {
                float axis = Input.GetAxisRaw("LeftStickXC" + player.id);
                if (axis != 0)
                {
                    playerVelocityX = playerSpeed * axis * Time.deltaTime;
                }
            }

            {
                float axis = Input.GetAxisRaw("LeftStickYC" + player.id);
                if (axis != 0)
                {
                    playerVelocityY = playerSpeed * axis * Time.deltaTime;
                }
            }

            //PRB.velocity += new Vector2(playerVelocityX, -playerVelocityY);
            PRB.AddForce(new Vector2(playerVelocityX, -playerVelocityY));

            float xAxis = Input.GetAxisRaw("RightStickXC" + player.id);
            float yAxis = Input.GetAxisRaw("RightStickYC" + player.id);

            if (Input.GetAxisRaw("Blink" + player.id) > 0.0f && blinkCD <= 0.0f)
            {
                Blink.CrossFadeAlpha(0.0f, 0.0f, true);
                GetComponent <SoundPlayer>().PlaySound("Blink");
                blinkCD = 5.0f;

                Vector3 newPos    = new Vector3((blinkDist * xAxis), -(blinkDist * yAxis));
                Vector3 newNewPos = player.transform.position + newPos;

                player.transform.position = newNewPos;

                playerVelocityX = playerSpeed * xAxis * Time.deltaTime * 10;
                playerVelocityY = playerSpeed * yAxis * Time.deltaTime * 10;

                PRB.velocity = new Vector2(0, 0);
                PRB.AddForce(new Vector2(playerVelocityX, -playerVelocityY));
                Blink.CrossFadeAlpha(1.0f, blinkCD, false);
            }
        }
    }