示例#1
0
    //Player Touches Enemy
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Enemy"))
        {
            deaths++;
            shaker.GetComponent <Shake>().ShakeObj();
            Destroy(ripple);
            Destroy(physicalCollider);
            Destroy(this);

            PlayerPrefs.SetFloat("Score", scorenumber);


            if (scorenumber > highScore)
            {
                highScore = scorenumber;
                PlayerPrefs.SetFloat("Highscore", scorenumber);
            }

            Debug.Log(PlayerPrefs.GetFloat("Score"));
            Debug.Log(PlayerPrefs.GetFloat("Highscore"));

            Time.timeScale = 0;
            gameOverCanvas.gameObject.SetActive(true);
            finalScoreDisplay.text = scorenumber.ToString();
            highScoreDisplay.text  = highScore.ToString();

            Debug.Log(deaths);
            PlayerPrefs.SetFloat("Deaths", deaths);
            deathPref = PlayerPrefs.GetFloat("Deaths");
            if (deathPref >= 1)
            {
                deaths = 0;
                PlayerPrefs.SetFloat("Deaths", 0);
                Debug.Log("Playing Ad");
                if (this.AD.IsLoaded())
                {
                    this.AD.Show();
                }
            }
        }
    }
示例#2
0
    private void Start()
    {
        _monster.Clear();


        states = GetComponent <StateManager>();
        states.Init();
        playerHP    = states._hp;
        playerMaxHP = states._maxHp;

        playerHP--;

        camManager = CameraManager.singleton;
        camManager.Init(this.transform);

        anim1 = GameObject.Find("PC_Rig").GetComponentInChildren <Animator>();
        anim2 = GameObject.Find("Luda").GetComponentInChildren <Animator>();

        anim1.gameObject.SetActive(true);
        anim2.gameObject.SetActive(false);

        //변신전후모델링교체
        //Normal = GameObject.Find("Normal").GetComponentInChildren<Transform>();
        //Special = GameObject.Find("Special").GetComponentInChildren<Transform>();

        //Normal.gameObject.SetActive(true);
        //Special.gameObject.SetActive(false);
        shake             = GameObject.Find("CameraRig").GetComponent <Shake>();
        maincamera        = GameObject.Find("mainCam").GetComponent <Camera>();
        followCam         = shake.GetComponent <FollowCam>();
        isAttackOne       = false;
        isAttackTwo       = false;
        isCantMove        = false;
        isFever           = false;
        anim1.avatar.name = "PC_RigAvatar";
        Attack_Capsule    = GameObject.FindGameObjectWithTag("Weapon").GetComponent <CapsuleCollider>();
        try
        {
        }
        catch
        {
        }


        ball1 = anim1.GetComponentInChildren <SphereCollider>();

        //ball1.gameObject.SetActive(false);
//        ballStartPos = GameObject.Find("BallStartPos").GetComponent<Transform>();

        try
        {
            Skill1_CoolTime            = GameObject.Find("Skill1_CoolTime").GetComponent <Image>();
            Skill1_CoolTime.fillAmount = 1f;
            Skill1_CoolTime.gameObject.SetActive(false);
        }
        catch
        {
        }

        try
        {
            Special_Gauge            = GameObject.Find("Special_Gauge").GetComponent <Image>();
            Special_Gauge.fillAmount = 0;
            Special_Gauge.gameObject.SetActive(true);
        }
        catch
        {
        }

        isInputLock = false;

        //1~3타 애니의 재생 길이
        attackOne   = AnimationLength("PC_Attack_001");
        attackTwo   = AnimationLength("PC_Attack_002");
        attackThree = AnimationLength("PC_Attack_003");
        backOne     = AnimationLength("PC_Attack_Back_001");
        jumpSpecial = AnimationLength("PC_Transform_001");
        //backTwo = AnimationLength("PC_Attack_Back_002");
    }
    //public float clip1, clip2;
    private void Start()
    {
        SetState(startState);
        _isinit = true;

        bloom.active = true;
        bloom.enabled.Override(true);
        bloom.enabled = new BoolParameter()
        {
            value = true, overrideState = false
        };


        vignette.active = true;
        vignette.enabled.Override(true);
        vignette.enabled = new BoolParameter()
        {
            value = true, overrideState = true
        };
        vignette.mode.overrideState    = true;
        vignette.color.overrideState   = true;
        vignette.mask.overrideState    = true;
        vignette.opacity.overrideState = true;

        parameter             = vignette.mode;
        parameter.value       = VignetteMode.Masked;
        vignette.color.value  = new Color(102, 0, 153, 30);
        Concent.overrideState = true;
        Concent.defaultState  = TextureParameterDefault.White;

        vignette.mask.value    = Concent.value;
        vignette.opacity.value = 0f;

        normalTimer    = Stat.transDuration;
        gaugePerSecond = 100.0f / normalTimer;



        //clip1 = AnimationClipChange("PC_Anim_Attack_003_2");

        _attack1Time  = AnimationLength("PC_Anim_Attack_001") / 1.5f;
        _attack2Time  = AnimationLength("PC_Anim_Attack_002") / 1.8f;
        _attack3Time  = AnimationLength("PC_Anim_Attack_003_2") / 1.5f;
        _attackBack1  = AnimationLength("PC_Anim_Attack_Back_001") / 1.3f;
        _attackBack2  = AnimationLength("PC_Anim_Attack_Back_002") / 1.3f;
        _specialAnim  = AnimationLength("PC_Anim_Transform_001");
        _skill2Time   = AnimationLength("PC_Anim_Skill_002");
        _skill3Time   = AnimationLength("PC_Anim_Skill_003");
        isAttackOne   = false;
        isAttackTwo   = false;
        isAttackThree = false;

        for (int i = 0; i < 5; i++)
        {
            Skill1_Effects[i].SetActive(false);
            Skill1_Shoots[i].SetActive(false);
            Skill1_Special_Effects[i].SetActive(false);
            Skill1_Special_Shoots[i].SetActive(false);
        }


        //camManager = CameraManager.singleton;
        //camManager.Init(this.transform);
        shake      = GameObject.Find("CameraRig").GetComponent <Shake>();
        mainCamera = GameObject.Find("mainCam").GetComponent <Camera>();
        followCam  = shake.GetComponent <FollowCam>();

        Skill1CTime = Stat.skillCTime[0];
        Skill2CTime = Stat.skillCTime[1];
        Skill3CTime = Stat.skillCTime[2];

        for (int i = 0; i < Shields.Count; i++)
        {
            Shields[i].SetActive(false);
        }
    }