Jump repair, add artefact prefab
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.SceneManagement;
 | 
			
		||||
 | 
			
		||||
public class PlayerManager : MonoBehaviour
 | 
			
		||||
{
 | 
			
		||||
@@ -165,7 +166,7 @@ public class PlayerManager : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    public void Die()
 | 
			
		||||
    {
 | 
			
		||||
        Application.LoadLevel(Application.loadedLevel);
 | 
			
		||||
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Animation()
 | 
			
		||||
@@ -218,7 +219,7 @@ public class PlayerManager : MonoBehaviour
 | 
			
		||||
            {
 | 
			
		||||
                pushPullObject = null;
 | 
			
		||||
                rigidBody.AddForce(
 | 
			
		||||
                    (transform.right * (run ? runSpeed : speed) * 5 * Input.GetAxis("Horizontal") * Time.deltaTime) + 
 | 
			
		||||
                    (transform.right * (run ? runSpeed : speed) * 15 * Input.GetAxis("Horizontal") * Time.deltaTime) + 
 | 
			
		||||
                    (transform.up * jump * 10 * Time.deltaTime), 
 | 
			
		||||
                    ForceMode.VelocityChange
 | 
			
		||||
                );
 | 
			
		||||
@@ -311,6 +312,11 @@ public class PlayerManager : MonoBehaviour
 | 
			
		||||
    {
 | 
			
		||||
        if (other.tag == "Ground" || other.tag == "Objects")
 | 
			
		||||
        {
 | 
			
		||||
            rigidBody.AddForce(
 | 
			
		||||
                (transform.right * (run ? runSpeed : speed) * 10 * Input.GetAxis("Horizontal") * Time.deltaTime) +
 | 
			
		||||
                (transform.up * 10 * Time.deltaTime),
 | 
			
		||||
                ForceMode.VelocityChange
 | 
			
		||||
            );
 | 
			
		||||
            onGround = false;
 | 
			
		||||
            dash = false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,17 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.SceneManagement;
 | 
			
		||||
 | 
			
		||||
public class PowerCubeManager : MonoBehaviour
 | 
			
		||||
{
 | 
			
		||||
    public enum PowerType {Nothing, Bigger, Faster, Jumper};
 | 
			
		||||
    public enum PowerType {Nothing, Bigger, Faster, Jumper, Artefact};
 | 
			
		||||
    public PowerType powerType = PowerType.Nothing;
 | 
			
		||||
    public float powerTime = 5f;
 | 
			
		||||
    public float powerUnit = 10f;
 | 
			
		||||
    private bool interact = false;
 | 
			
		||||
    public string nextSceneName;
 | 
			
		||||
    private MeshRenderer meshRenderer;
 | 
			
		||||
 | 
			
		||||
    void Start()
 | 
			
		||||
    {
 | 
			
		||||
@@ -22,11 +26,42 @@ public class PowerCubeManager : MonoBehaviour
 | 
			
		||||
        {
 | 
			
		||||
            GetComponentInChildren<MeshRenderer>().material.color = Color.green;
 | 
			
		||||
        }
 | 
			
		||||
        else if (powerType == PowerType.Artefact)
 | 
			
		||||
        {
 | 
			
		||||
            meshRenderer = GetComponentInChildren<MeshRenderer>();
 | 
			
		||||
            meshRenderer.materials[1].SetFloat("_Outline", 0.0f);
 | 
			
		||||
            meshRenderer.materials[1].SetColor("_OutlineColor", new Color(0.5276349f, 0.5566038f, 0.118147f));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Update()
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        if (interact) {
 | 
			
		||||
            if (powerType == PowerType.Artefact)
 | 
			
		||||
            {
 | 
			
		||||
                if (Input.GetKeyUp(KeyCode.E))
 | 
			
		||||
                {
 | 
			
		||||
                    SceneManager.LoadScene(nextSceneName);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void OnTriggerEnter(Collider other)
 | 
			
		||||
    {
 | 
			
		||||
        if (other.gameObject.tag == "Player")
 | 
			
		||||
        {
 | 
			
		||||
            meshRenderer.materials[1].SetFloat("_Outline", 0.01f);
 | 
			
		||||
            interact = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    private void OnTriggerExit(Collider other)
 | 
			
		||||
    {
 | 
			
		||||
        if (other.gameObject.tag == "Player")
 | 
			
		||||
        {
 | 
			
		||||
            meshRenderer.materials[1].SetFloat("_Outline", 0.0f);
 | 
			
		||||
            interact = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user