コード例 #1
0
ファイル: EnemyMatrix.cs プロジェクト: yakirLLC/SpaceInvaders
 protected virtual void OnPlayerDown(GameManagerEventArgs e)
 {
     if (PlayerDown != null)
     {
         PlayerDown.Invoke(this, e);
     }
 }
コード例 #2
0
    public void ScaleShrinkGrow()
    {
        if (Input.GetButton("Fire1"))
        {
            StaffANIM.SetBool("TranGrowP", true);
            StaffANIM.SetBool("IsGrowingP", true);
            if (TranGP == true)
            {
                if (InVol == false)
                {
                    if (mass > 0f)
                    {
                        Player.transform.localScale = Vector3.Lerp(Player.transform.localScale, new Vector3(PSgrow, PSgrow, PSgrow), Time.deltaTime * PSgrowtime);

                        if (CurrentSize.magnitude <= maxSize.magnitude)
                        {
                            gameManager.GetComponent <GameManager>().MassAvailable -= (GrowTime * Time.deltaTime);
                        }
                        if (CurrentSize.magnitude >= maxSize.magnitude)
                        {
                            Debug.Log("TooLorge");
                        }
                    }
                    if (mass <= 0f)
                    {
                        Debug.Log("NoMass");
                    }
                }
            }
        }

        if (Input.GetButtonDown("Fire1"))
        {
            PlayerUP.Invoke();
            if (TooLorge == true)
            {
                Debug.Log("DeadByLorge");
                Dead.Invoke();
                StartCoroutine(DiedDead(.5f));
            }
        }
        if (Input.GetButtonUp("Fire1"))
        {
            StaffANIM.SetBool("IsGrowingP", false);
            StaffANIM.SetBool("TranGrowP", false);
            Wipe.Invoke();
        }


        if (Input.GetButton("Fire2"))
        {
            StaffANIM.SetBool("TranShrinkP", true);
            StaffANIM.SetBool("IsShrinkingP", true);
            if (InVol == false && TranSP == true)
            {
                Player.transform.localScale = Vector3.Lerp(Player.transform.localScale, new Vector3(PSshrink, PSshrink, PSshrink), Time.deltaTime * PSshrinktime);
                if (CurrentSize.magnitude < avgSize.magnitude)
                {
                    if (CurrentSize.magnitude >= PminSize.magnitude)
                    {
                        gameManager.GetComponent <GameManager>().MassAvailable += (GrowTime * Time.deltaTime) * 1.25f;
                    }
                    if (CurrentSize.magnitude <= PminSize.magnitude)
                    {
                        Debug.Log("smol");
                    }
                }
            }
        }


        if (Input.GetButtonDown("Fire2"))
        {
            PlayerDown.Invoke();
            if (TooSmol == true)
            {
                Debug.Log("DeadBySmol");
                Dead.Invoke();
                StartCoroutine(DiedDead(.5f));
            }
        }
        if (Input.GetButtonUp("Fire2"))
        {
            Wipe.Invoke();
            StaffANIM.SetBool("TranShrinkP", false);
            StaffANIM.SetBool("IsShrinkingP", false);
        }
    }