Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == 19 && !this.Destroyed)
     {
         UnityEngine.Object.Instantiate <GameObject>(this.DestroyedCandlestick, base.transform.position, Quaternion.identity).transform.localScale = base.transform.localScale;
         this.Destroyed = true;
         AudioClipPlayer.Play2D(this.Break, base.transform.position);
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Exemple #2
0
 // Token: 0x06001DE3 RID: 7651 RVA: 0x00175FD0 File Offset: 0x001741D0
 private void SpinLeft()
 {
     if (!this.SpunLeft)
     {
         AudioClipPlayer.Play2D(this.WhipSound, base.transform.position, UnityEngine.Random.Range(0.9f, 1.1f));
         this.StraightenWhip();
         this.TargetRotation = -360f;
         this.Rotation       = 0f;
         this.SpunLeft       = true;
     }
     this.Character.GetComponent <Animation>().CrossFade("f02_yanvaniaWhip_Left", 0.1f);
 }
Exemple #3
0
 // Token: 0x06001DEA RID: 7658 RVA: 0x00176210 File Offset: 0x00174410
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == 19 && !this.Destroyed)
     {
         UnityEngine.Object.Instantiate <GameObject>(this.Explosion, base.transform.position + Vector3.up * 0.5f, Quaternion.identity);
         this.Destroyed = true;
         AudioClipPlayer.Play2D(this.Break, base.transform.position);
         for (int i = 1; i < 11; i++)
         {
             UnityEngine.Object.Instantiate <GameObject>(this.Shard, base.transform.position + Vector3.up * UnityEngine.Random.Range(0f, 1f) + Vector3.right * UnityEngine.Random.Range(-0.5f, 0.5f), Quaternion.identity);
         }
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Exemple #4
0
 // Token: 0x06001DE1 RID: 7649 RVA: 0x00175F04 File Offset: 0x00174104
 private void FallingDamageAlert(float fallDistance)
 {
     AudioClipPlayer.Play2D(this.LandSound, base.transform.position, UnityEngine.Random.Range(0.9f, 1.1f));
     this.Character.GetComponent <Animation>().Play("f02_yanvaniaCrouch_00");
     this.fallingDamageThreshold = this.originalThreshold;
 }
Exemple #5
0
    // Token: 0x06001DDE RID: 7646 RVA: 0x00175538 File Offset: 0x00173738
    private void Update()
    {
        Animation component = this.Character.GetComponent <Animation>();

        if (!this.Injured && this.CanMove && !this.Cutscene)
        {
            if (this.grounded)
            {
                if (this.InputManager.TappedRight || this.InputManager.TappedLeft)
                {
                    this.TapTimer = 0.25f;
                    this.Taps++;
                }
                if (this.Taps > 1)
                {
                    this.speed = this.runSpeed;
                }
            }
            if (this.inputX == 0f)
            {
                this.speed = this.walkSpeed;
            }
            this.TapTimer -= Time.deltaTime;
            if (this.TapTimer < 0f)
            {
                this.Taps = 0;
            }
            if (Input.GetButtonDown("VaniaAttack") && !this.Attacking)
            {
                AudioSource.PlayClipAtPoint(this.WhipSound, base.transform.position);
                AudioSource component2 = base.GetComponent <AudioSource>();
                component2.clip = this.Voices[UnityEngine.Random.Range(0, this.Voices.Length)];
                component2.Play();
                this.WhipChain[0].transform.localScale = Vector3.zero;
                this.Attacking = true;
                this.IdleTimer = 10f;
                if (this.Crouching)
                {
                    component["f02_yanvaniaCrouchAttack_00"].time = 0f;
                    component.Play("f02_yanvaniaCrouchAttack_00");
                }
                else
                {
                    component["f02_yanvaniaAttack_00"].time = 0f;
                    component.Play("f02_yanvaniaAttack_00");
                }
                if (this.grounded)
                {
                    this.moveDirection.x = 0f;
                    this.inputX          = 0f;
                    this.speed           = 0f;
                }
            }
            if (this.Attacking)
            {
                if (!this.Dangling)
                {
                    this.WhipChain[0].transform.localScale = Vector3.MoveTowards(this.WhipChain[0].transform.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 5f);
                    this.StraightenWhip();
                }
                else
                {
                    this.LoosenWhip();
                    if (Input.GetAxis("VaniaHorizontal") > -0.5f && Input.GetAxis("VaniaHorizontal") < 0.5f && Input.GetAxis("VaniaVertical") > -0.5f && Input.GetAxis("VaniaVertical") < 0.5f)
                    {
                        component.CrossFade("f02_yanvaniaWhip_Neutral");
                        if (this.Crouching)
                        {
                            component["f02_yanvaniaCrouchPose_00"].weight = 1f;
                        }
                        this.SpunUp    = false;
                        this.SpunDown  = false;
                        this.SpunRight = false;
                        this.SpunLeft  = false;
                    }
                    else
                    {
                        if (Input.GetAxis("VaniaVertical") > 0.5f)
                        {
                            if (!this.SpunUp)
                            {
                                AudioClipPlayer.Play2D(this.WhipSound, base.transform.position, UnityEngine.Random.Range(0.9f, 1.1f));
                                this.StraightenWhip();
                                this.TargetRotation = -360f;
                                this.Rotation       = 0f;
                                this.SpunUp         = true;
                            }
                            component.CrossFade("f02_yanvaniaWhip_Up", 0.1f);
                        }
                        else
                        {
                            this.SpunUp = false;
                        }
                        if (Input.GetAxis("VaniaVertical") < -0.5f)
                        {
                            if (!this.SpunDown)
                            {
                                AudioClipPlayer.Play2D(this.WhipSound, base.transform.position, UnityEngine.Random.Range(0.9f, 1.1f));
                                this.StraightenWhip();
                                this.TargetRotation = 360f;
                                this.Rotation       = 0f;
                                this.SpunDown       = true;
                            }
                            component.CrossFade("f02_yanvaniaWhip_Down", 0.1f);
                        }
                        else
                        {
                            this.SpunDown = false;
                        }
                        if (Input.GetAxis("VaniaHorizontal") > 0.5f)
                        {
                            if (this.Character.transform.localScale.x == 1f)
                            {
                                this.SpinRight();
                            }
                            else
                            {
                                this.SpinLeft();
                            }
                        }
                        else if (this.Character.transform.localScale.x == 1f)
                        {
                            this.SpunRight = false;
                        }
                        else
                        {
                            this.SpunLeft = false;
                        }
                        if (Input.GetAxis("VaniaHorizontal") < -0.5f)
                        {
                            if (this.Character.transform.localScale.x == 1f)
                            {
                                this.SpinLeft();
                            }
                            else
                            {
                                this.SpinRight();
                            }
                        }
                        else if (this.Character.transform.localScale.x == 1f)
                        {
                            this.SpunLeft = false;
                        }
                        else
                        {
                            this.SpunRight = false;
                        }
                    }
                    this.Rotation = Mathf.MoveTowards(this.Rotation, this.TargetRotation, Time.deltaTime * 3600f * 0.5f);
                    this.WhipChain[1].transform.localEulerAngles = new Vector3(0f, 0f, this.Rotation);
                    if (!Input.GetButton("VaniaAttack"))
                    {
                        this.StopAttacking();
                    }
                }
            }
            else
            {
                if (this.WhipCollider[1].enabled)
                {
                    for (int i = 1; i < this.WhipChain.Length; i++)
                    {
                        this.SphereCollider[i].enabled = false;
                        this.WhipCollider[i].enabled   = false;
                    }
                }
                this.WhipChain[0].transform.localScale = Vector3.MoveTowards(this.WhipChain[0].transform.localScale, Vector3.zero, Time.deltaTime * 10f);
            }
            if ((!this.Crouching && component["f02_yanvaniaAttack_00"].time >= component["f02_yanvaniaAttack_00"].length) || (this.Crouching && component["f02_yanvaniaCrouchAttack_00"].time >= component["f02_yanvaniaCrouchAttack_00"].length))
            {
                if (Input.GetButton("VaniaAttack"))
                {
                    if (this.Crouching)
                    {
                        component["f02_yanvaniaCrouchPose_00"].weight = 1f;
                    }
                    this.Dangling = true;
                }
                else
                {
                    this.StopAttacking();
                }
            }
        }
        if (this.FlashTimer > 0f)
        {
            this.FlashTimer -= Time.deltaTime;
            if (!this.Red)
            {
                Material[] materials = this.MyRenderer.materials;
                for (int j = 0; j < materials.Length; j++)
                {
                    materials[j].color = new Color(1f, 0f, 0f, 1f);
                }
                this.Frames++;
                if (this.Frames == 5)
                {
                    this.Frames = 0;
                    this.Red    = true;
                }
            }
            else
            {
                Material[] materials = this.MyRenderer.materials;
                for (int j = 0; j < materials.Length; j++)
                {
                    materials[j].color = new Color(1f, 1f, 1f, 1f);
                }
                this.Frames++;
                if (this.Frames == 5)
                {
                    this.Frames = 0;
                    this.Red    = false;
                }
            }
        }
        else
        {
            this.FlashTimer = 0f;
            if (this.MyRenderer.materials[0].color != new Color(1f, 1f, 1f, 1f))
            {
                Material[] materials = this.MyRenderer.materials;
                for (int j = 0; j < materials.Length; j++)
                {
                    materials[j].color = new Color(1f, 1f, 1f, 1f);
                }
            }
        }
        this.HealthBar.localScale = new Vector3(this.HealthBar.localScale.x, Mathf.Lerp(this.HealthBar.localScale.y, this.Health / this.MaxHealth, Time.deltaTime * 10f), this.HealthBar.localScale.z);
        if (this.Health > 0f)
        {
            if (this.EXP >= 100f)
            {
                this.Level++;
                if (this.Level >= 99)
                {
                    this.Level = 99;
                }
                else
                {
                    UnityEngine.Object.Instantiate <GameObject>(this.LevelUpEffect, this.LevelLabel.transform.position, Quaternion.identity).transform.parent = this.LevelLabel.transform;
                    this.MaxHealth += 20f;
                    this.Health     = this.MaxHealth;
                    this.EXP       -= 100f;
                }
                this.LevelLabel.text = this.Level.ToString();
            }
            this.EXPBar.localScale = new Vector3(this.EXPBar.localScale.x, Mathf.Lerp(this.EXPBar.localScale.y, this.EXP / 100f, Time.deltaTime * 10f), this.EXPBar.localScale.z);
        }
        base.transform.position = new Vector3(base.transform.position.x, base.transform.position.y, 0f);
        if (Input.GetKeyDown(KeyCode.BackQuote))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            base.transform.position = new Vector3(-31.75f, 6.51f, 0f);
            Physics.SyncTransforms();
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            this.Level           = 5;
            this.LevelLabel.text = this.Level.ToString();
        }
        if (Input.GetKeyDown(KeyCode.Equals))
        {
            Time.timeScale += 10f;
        }
        if (Input.GetKeyDown(KeyCode.Minus))
        {
            Time.timeScale -= 10f;
            if (Time.timeScale < 0f)
            {
                Time.timeScale = 1f;
            }
        }
    }