Ejemplo n.º 1
0
    void Start()
    {
        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().P1Side == "Left")
        {
            p1Start = new Vector3(-1f, 1.127f, -3);
        }
        else
        {
            p1Start = new Vector3(1f, 1.127f, -3);
        }

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().P2Side == "Right")
        {
            p2Start = new Vector3(1f, 1.127f, -3);
        }
        else
        {
            p2Start = new Vector3(-1f, 1.127f, -3);
        }

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode != "Practice" && GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode != "Tutorial")
        {
            //Setting private character property variables to their appropriate player 1 and 2 child respectively
            P1Prop = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
            P2Prop = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();

            //Setting AcceptInputs to lock them on transitions
            P1Inputs = GameObject.Find("Player1").transform.GetComponentInChildren <AcceptInputs>();
            P2Inputs = GameObject.Find("Player2").transform.GetComponentInChildren <AcceptInputs>();

            //Setting private menu child game obejcts to their appropriate menu children respectively
            child1 = p1menu.transform.GetChild(0).gameObject;
            child2 = p2menu.transform.GetChild(0).gameObject;
            //Setting timers to an arbitrarily picked -2 for standby
            endTimer      = -2;
            replayTimer   = -2;
            overtimeTimer = -2;
            //Setting round timer to 99 (eventually will make it into a public variable for easier manipulation/access)
            roundTimer = 99;
            roundCount = 1;
            //Setting text variables to proper win text for each player
            //Telling round not to start yet
            gameActive = false;
            lockInputs = true;

            dizzyKO   = false;
            matchOver = false;
        }
        else if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Practice" || GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Tutorial")
        {
            //Setting private character property variables to their appropriate player 1 and 2 child respectively
            P1Prop     = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
            P2Prop     = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();
            gameActive = true;
            roundCount = 0;
            startReady = true;
        }
        holdpositions = false;
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        Application.targetFrameRate = 60;

        LoGuard  = Animator.StringToHash("LowGuard");
        HiGuard  = Animator.StringToHash("HighGuard");
        AirGuard = Animator.StringToHash("AirGuard");

        crouchID      = Animator.StringToHash("Crouch");
        runID         = Animator.StringToHash("Run");
        animSpeedID   = Animator.StringToHash("AnimSpeed");
        hitStunID     = Animator.StringToHash("HitStun");
        blockStunID   = Animator.StringToHash("BlockStun");
        clashID       = Animator.StringToHash("Clash");
        deflectID     = Animator.StringToHash("Deflected");
        parryID       = Animator.StringToHash("Parry");
        successID     = Animator.StringToHash("HitSuccess");
        hitID         = Animator.StringToHash("Hit");
        hitAirID      = Animator.StringToHash("HitAir");
        hitBodyID     = Animator.StringToHash("HitBody");
        hitLegsID     = Animator.StringToHash("HitLegs");
        launchID      = Animator.StringToHash("Launch");
        crumpleID     = Animator.StringToHash("Crumple");
        sweepID       = Animator.StringToHash("Sweep");
        shatterID     = Animator.StringToHash("Shatter");
        armorHitID    = Animator.StringToHash("ArmorHit");
        throwRejectID = Animator.StringToHash("ThrowReject");
        dizzyID       = Animator.StringToHash("Dizzy");
        KOID          = Animator.StringToHash("KOed");

        guardID = Animator.StringToHash("Guard");

        pauseScreen = GameObject.Find("PauseManager").GetComponentInChildren <PauseMenu>();

        Actions          = transform.root.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        HitDetect        = Actions.Move.HitDetect;
        OpponentDetector = HitDetect.OpponentDetector;
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        Player1          = GameObject.Find("Player1");
        Player2          = GameObject.Find("Player2");
        characterManager = GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>();
        P1Prop           = GameObject.Find("Player1").transform.GetComponentInChildren <CharacterProperties>();
        P2Prop           = GameObject.Find("Player2").transform.GetComponentInChildren <CharacterProperties>();
        P1hit            = GameObject.Find("Player1").transform.GetComponentInChildren <HitDetector>();
        P2hit            = GameObject.Find("Player2").transform.GetComponentInChildren <HitDetector>();
        P1Input          = GameObject.Find("Player1").transform.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        P2Input          = GameObject.Find("Player2").transform.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
        P1Move           = GameObject.Find("Player1").transform.GetComponentInChildren <MovementHandler>();
        P2Move           = GameObject.Find("Player2").transform.GetComponentInChildren <MovementHandler>();
        HUD = GameObject.Find("HUD").GetComponent <HUD>();

        if (characterManager.P1Character == "Dhalia")
        {
            P1AttackDHA = GameObject.Find("Player1").transform.GetComponentInChildren <AttackHandlerDHA>();
        }
        if (characterManager.P2Character == "Dhalia")
        {
            P2AttackDHA = GameObject.Find("Player2").transform.GetComponentInChildren <AttackHandlerDHA>();
        }
        if (characterManager.P1Character == "Achealis")
        {
            P1AttackACH = GameObject.Find("Player1").transform.GetComponentInChildren <AttackHandlerACH>();
        }
        if (characterManager.P2Character == "Achealis")
        {
            P2AttackACH = GameObject.Find("Player2").transform.GetComponentInChildren <AttackHandlerACH>();
        }
        path = Application.persistentDataPath + "/inputs.txt";

        P1PrevHealth           = P1Prop.maxHealth;
        P2PrevHealth           = P2Prop.maxHealth;
        P1HitDamage.text       = "";
        P2HitDamage.text       = "";
        P1ComboDamage.text     = "Total Damage: 0";
        P2ComboDamage.text     = "Total Damage: 0";
        P1HighComboDamage.text = "Highest Combo Damage: 0";
        P2HighComboDamage.text = "Highest Combo Damage: 0";

        inputSelect     += UpdateControls(CheckXbox(0));
        inputR3         += UpdateControls(CheckXbox(0));
        inputL2         += UpdateControls(CheckXbox(0));
        inputL3         += UpdateControls(CheckXbox(0));
        inputCross      += UpdateControls(CheckXbox(0));
        inputCircle     += UpdateControls(CheckXbox(0));
        inputTriangle   += UpdateControls(CheckXbox(0));
        inputSquare     += UpdateControls(CheckXbox(0));
        inputHorizontal += UpdateControls(CheckXbox(0));
        inputVertical   += UpdateControls(CheckXbox(0));

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().P1Side == "Left")
        {
            P2Displays.SetActive(false);
        }
        else
        {
            P1Displays.SetActive(false);
        }

        if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Practice")
        {
            DamageDisplays.SetActive(true);
            RecordingDisplay.SetActive(true);
        }
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (Actions == null || HitDetect == null || OpponentDetector == null)
        {
            Actions          = transform.root.GetChild(0).transform.GetComponentInChildren <AcceptInputs>();
            HitDetect        = Actions.Move.HitDetect;
            OpponentDetector = HitDetect.OpponentDetector;
        }
        opponentValor = Actions.Move.OpponentProperties.currentValor;

        if ((Input.GetButtonDown("Start_P1") || Input.GetButtonDown("Start_P2")) && pauseScreen.isPaused)
        {
            currentVelocity        = rb.velocity;
            currentAngularVelocity = rb.angularVelocity;
        }

        if ((pauseScreen.isPaused && hitStop <= 0) || OpponentDetector.Actions.superFlash > 0)
        {
            hitStop = (float)1 / 60;
        }

        if (hitStop > 0)
        {
            //hitStop to give hits more impact and allow time to input next move
            anim.SetFloat(animSpeedID, 0f);
            rb.constraints = RigidbodyConstraints2D.FreezeAll;
            if (!pauseScreen.isPaused)
            {
                hitStop -= Time.deltaTime;
            }
        }
        else
        {
            hitStop = 0;
            anim.SetFloat(animSpeedID, 1.0f);
            if (rb.constraints == RigidbodyConstraints2D.FreezeAll)
            {
                rb.constraints = RigidbodyConstraints2D.None;
            }

            if (OpponentDetector.Actions.blitzed > 0)
            {
                //simulate slow motion on projectile if within range of a blitz cancel or blitz attack
                if (OpponentDetector.Actions.blitzed <= (float)59 / 60 && OpponentDetector.Actions.blitzed >= (float)58 / 60)
                {
                    rb.velocity        *= .5f;
                    rb.angularVelocity *= .75f;
                    rb.mass            *= .5f;
                    rb.gravityScale    *= .5f;
                }

                anim.SetFloat(animSpeedID, .5f);
            }
            else if (OpponentDetector.Actions.blitzed >= (float)1 / 60 && OpponentDetector.Actions.blitzed <= (float)2 / 60)
            {
                rb.velocity        /= .5f;
                rb.angularVelocity /= .5f;

                rb.mass         /= .5f;
                rb.gravityScale /= .5f;
                anim.SetFloat(animSpeedID, 1f);
            }

            if (currentVelocity != Vector2.zero)
            {
                //retain velocity after hitStop occurs
                rb.velocity            = currentVelocity;
                rb.angularVelocity     = currentAngularVelocity;
                currentVelocity        = Vector2.zero;
                currentAngularVelocity = 0;
            }
        }

        if (hitStop == 0)
        {
            anim.ResetTrigger(successID);
        }
    }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     OpponentActions = transform.root.GetChild(0).GetComponent <MovementHandler>().HitDetect.OpponentDetector.Actions;
 }