// 決着が着いた(どちらが勝ったか)
    public int GameSet()
    {
        int setNum = NONE;

        // Player1のHPが0以下になったら
        // Player2の勝利
        if (HP1.GetNowHP() <= 0)
        {
            setNum = PLAYER2_WIN;
        }
        // Player2のHPが0以下になったら
        // Player1の勝利
        if (HP2.GetNowHP() <= 0)
        {
            setNum = PLAYER1_WIN;
        }
        return(setNum);
    }
    // Update is called once per frame
    void Update()
    {
        HP1.GetComponent <Image> ().fillAmount = Mathf.Max(InGameParameter.CharacterHitPoint - 20, 0) / 10.0f;
        HP2.GetComponent <Image> ().fillAmount = Mathf.Max(Mathf.Min(InGameParameter.CharacterHitPoint - 10, 10), 0) / 10.0f;
        HP3.GetComponent <Image> ().fillAmount = Mathf.Max(Mathf.Min(InGameParameter.CharacterHitPoint, 10), 0) / 10.0f;

        if (InGameParameter.CharacterChangeGage > 100)
        {
            InGameParameter.CharacterChangeGage = 100;
        }
        Gage.GetComponent <Image> ().fillAmount = InGameParameter.CharacterChangeGage / 100.0f;

        FlickerGage.SetActive(InGameParameter.CharacterChangeGage >= 100);
        Bomb.SetActive(InGameParameter.CharacterHasBomb || InGameParameter.IsCharacterChanged);

        Sprite powerLevelSprite = null;
        int    powerLevel       = InGameParameter.CharacterPowerLevel;

        if (InGameParameter.IsCharacterChanged)
        {
            powerLevel = 5;
        }
        switch (powerLevel)
        {
        case 1: powerLevelSprite = Lv1; break;

        case 2: powerLevelSprite = Lv2; break;

        case 3: powerLevelSprite = Lv3; break;

        case 4: powerLevelSprite = Lv4; break;

        case 5: powerLevelSprite = Lv5; break;
        }
        PowerLevel.GetComponent <SpriteRenderer> ().sprite = powerLevelSprite;

        PointFont.GetComponent <ShFont> ().Value = InGameParameter.CurrentPoint;

        if (InGameParameter.CharacterHitPoint <= 0)
        {
            GameOverOverlay.SetActive(true);
        }
    }
Example #3
0
    public void Initialize()
    {
        HP1.Initialise();
        HP2.Initialise();

        HP1.HPScale     = new Vector3(1, 1, 1);
        HP1.DamageScale = new Vector3(1, 1, 1);
        HP2.HPScale     = new Vector3(1, 1, 1);
        HP2.DamageScale = new Vector3(1, 1, 1);

        Guard1.Initialise();
        Guard2.Initialise();

        player1.transform.position = initPos1;
        player2.transform.position = initPos2;

        player1Controller.CanControll = false;
        player2Controller.CanControll = false;

        player1Controller.Direction = 1;
        player2Controller.Direction = 2;

        //comboScript.NoneCombo();
    }
    // Update is called once per frame
    void Update()
    {
        if (textScript.GetGameSet() == false && gameScript.GetPlayerWin() == 0)
        {
            timer += Time.deltaTime;
            if (timer >= 3.0f)
            {
                sceneManager.SceneChange("play");
            }
        }
        if (gameScript.GetPlayerWin() == 1 || gameScript.GetPlayerWin() == 2)
        {
            timer += Time.deltaTime;
            if (timer >= 5.0f)
            {
                sceneManager.SceneChange("title");
            }
        }
        //情報をリセット
        if (Input.GetKey(KeyCode.R))
        {
            HP1.Initialise();
            HP2.Initialise();

            HP1.HPScale     = new Vector3(1, 1, 1);
            HP1.DamageScale = new Vector3(1, 1, 1);
            HP2.HPScale     = new Vector3(1, 1, 1);
            HP2.DamageScale = new Vector3(1, 1, 1);

            player1.transform.position = initPos1;
            player2.transform.position = initPos2;

            comboScript.NoneCombo();
            gameScript.ResetGame(image);
        }
    }
Example #5
0
 private void Update()
 {
     Coins.text  = coins.ToString();
     Apples.text = apples.ToString();
     IsGrounded  = Physics2D.OverlapCircle(groundCheck.position, 0.5f, whatIsGround);        //0.485f
     if (IsGrounded && rb.velocity.y > -0.01f && rb.velocity.y < 0.01f)
     {
         jump = 0;
         anim.SetInteger("State", 0);
     }
     if (jump == 3)
     {
         jump = 1;
     }
     if (Input.GetAxis("Horizontal") < 0)
     {
         GetComponent <SpriteRenderer>().flipX       = true;
         Fight.GetComponent <BoxCollider2D>().offset = new Vector2(-0.06089044f, 0.02222253f);
         if (IsGrounded && rb.velocity.y > -0.01f && rb.velocity.y < 0.01f)
         {
             anim.SetInteger("State", 1);
         }
     }
     if (Input.GetAxis("Horizontal") > 0)
     {
         GetComponent <SpriteRenderer>().flipX       = false;
         Fight.GetComponent <BoxCollider2D>().offset = new Vector2(0.06089044f, 0.02222253f);
         if (IsGrounded && rb.velocity.y > -0.01f && rb.velocity.y < 0.01f)
         {
             anim.SetInteger("State", 1);
         }
     }
     if (rb.velocity.y > 0.01f)
     {
         anim.SetInteger("State", 2);
     }
     else if (rb.velocity.y < -0.01f)
     {
         anim.SetInteger("State", 3);
     }
     if (Input.GetKeyDown(KeyCode.UpArrow) && (IsGrounded || jump < 2))
     {
         jump += 1;
         if (jump == 1 || jump == 3)
         {
             anim.SetInteger("State", 5);
         }
         rb.velocity = Vector2.up * 12f;
     }
     if (Input.GetKeyDown(KeyCode.Z) && zPress == 0 && anim.GetCurrentAnimatorStateInfo(0).IsName("Attack_1") == false)
     {
         zPress = 1;
         anim.SetTrigger("Attack");
     }
     if (Input.GetKeyUp(KeyCode.Z))
     {
         zPress = 0;
     }
     if (Input.GetKeyDown(KeyCode.X) && xPress == 0 && anim.GetCurrentAnimatorStateInfo(0).IsName("Attack_2") == false)
     {
         xPress = 1;
         anim.SetTrigger("Attack2");
     }
     if (Input.GetKeyUp(KeyCode.X))
     {
         xPress = 0;
     }
     if (anim.GetCurrentAnimatorStateInfo(0).IsName("Attack_1") == true || anim.GetCurrentAnimatorStateInfo(0).IsName("Attack_2") == true)
     {
         eboshit = 1;
     }
     else
     {
         eboshit = 0;
     }
     if (IamHere == 1)
     {
         StartCoroutine(Bullet());
     }
     if (HPoint == 3)
     {
         HP1.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
         HP2.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
         HP3.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
     }
     if (HPoint == 2)
     {
         HP1.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
         HP2.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
         HP3.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
     }
     if (HPoint == 1)
     {
         HP1.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 255f);
         HP2.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
         HP3.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
     }
     if (HPoint == 0)
     {
         HP1.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
         HP2.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
         HP3.GetComponent <Image>().color = new Vector4(255f, 255f, 255f, 0f);
         transform.position = CheckPoint;
         HPoint             = 3;
     }
     if (plus15)
     {
         StartCoroutine(Plus1());
         plus15 = false;
     }
     if (plus25)
     {
         StartCoroutine(Plus2());
         plus25 = false;
     }
     if (plus50)
     {
         StartCoroutine(Plus3());
         plus50 = false;
     }
     if (transform.position.x < 0)
     {
         DownText.text = "Walk and jump on arrows. Fight on Z and X. Good luck!";
     }
     if (meetSodier)
     {
         DownText.text = "Horde Soldier: Go away, She-ra!";
     }
     else if (meetBug)
     {
         DownText.text = "Strange Creature: I came to find apples and won't go without one. If you have it, press right ctrl and give me it.";
     }
     else if (!meetBug && !meetSodier && transform.position.x >= 0)
     {
         DownText.text = "";
     }
 }