// Use this for initialization void Start() { maxHP = 5; grimHP = maxHP; maxKeys = 4; player = GetComponent <PlatformerController>(); physics = GetComponent <PlatformerPhysics> (); maskDifference = PlayerPrefs.GetFloat("soulCount"); goodDash = PlayerPrefs.GetInt("goodDash"); evilDash = PlayerPrefs.GetInt("evilDash"); evilAttack = PlayerPrefs.GetInt("evilAttack"); goodAttack = PlayerPrefs.GetInt("goodAttack"); //healthScale = healthBar.transform.localScale; //healthBar = GameObject.Find("HealthBar").GetComponent<SpriteRenderer>(); if (evilDash == 1) { physics.hasEvilDash = true; } else if (goodDash == 1) { physics.hasGoodDash = true; } if (evilAttack == 1) { physics.hasEvilAttack = true; } else if (goodAttack == 1) { physics.hasGoodAttack = true; } }
void Start() { mHasControl = true; mPlayer = GetComponent<PlatformerPhysics>(); if (mPlayer == null) Debug.LogError("This object also needs a PlatformerPhysics component attached for the controller to function properly"); }
void OnTriggerEnter(Collider other) { if (entered || other.tag != "Player") { return; } entered = true; PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>(); grimInfo info = other.gameObject.GetComponent <grimInfo>(); if (info.soulCount + info.maskDifference < 0) // good { phys.hasEvilAttack = false; phys.hasGoodAttack = true; Instantiate(goodSkully, location, Quaternion.Euler(new Vector3(0, 0, 0))); PlayerPrefs.SetInt("evilAttack", 0); PlayerPrefs.SetInt("goodAttack", 1); } else // bad { phys.hasEvilAttack = true; phys.hasGoodAttack = false; Instantiate(badSkully, location, Quaternion.Euler(new Vector3(0, 0, 0))); PlayerPrefs.SetInt("evilAttack", 1); PlayerPrefs.SetInt("goodAttack", 0); } }
private void Awake() { physics = GetComponent <PlatformerPhysics>(); stats = GetComponent <CharacterStats>(); stats.OnDamageTaken += OnDamageTaken; SetFacingDir(InitialFacingDir); OnAwake(); }
public BoxCollisionInfo(PlatformerPhysics p) { Top = new EdgeCollisionInfo(p); Bottom = new EdgeCollisionInfo(p); Left = new EdgeCollisionInfo(p); Right = new EdgeCollisionInfo(p); LastFacingDir = 1; }
void Start() { mHasControl = true; mPlayer = GetComponent <PlatformerPhysics>(); if (mPlayer == null) { Debug.LogError("This object also needs a PlatformerPhysics component attached for the controller to function properly"); } }
void OnTriggerEnter(Collider other) { PlatformerPhysics physics = other.gameObject.GetComponent <PlatformerPhysics>(); if (physics) { //set new respawn point physics.SetRespawnPoint(transform.position); } }
void OnTriggerEnter(Collider other) { PlatformerPhysics physics = other.gameObject.GetComponent <PlatformerPhysics>(); if (physics) { //unlock double jump and destroy ourselves physics.canDoubleJump = true; Destroy(gameObject); } }
private void Detach(PlatformerPhysics passenger) { var key = passenger.gameObject.GetInstanceID(); if (!passengers.ContainsKey(key)) { return; } passengers.Remove(key); passenger.gameObject.transform.parent = null; }
private void Attach(PlatformerPhysics passenger) { var key = passenger.gameObject.GetInstanceID(); if (passengers.ContainsKey(key)) { return; } passengers.Add(key, passenger); passenger.gameObject.transform.parent = transform; }
void OnTriggerEnter(Collider other) { player = GameObject.FindGameObjectWithTag("Player"); PlatformerPhysics physics = other.gameObject.GetComponent <PlatformerPhysics>(); if (other.gameObject == player) { //set new respawn point physics.SetRespawnPoint(transform.position); // Destroy this gameobject Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { if (entered || other.tag != "Player") { return; } entered = true; PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>(); grimInfo info = other.gameObject.GetComponent <grimInfo>(); if (info.soulCount + info.maskDifference < 0) // good { PlayerPrefs.SetFloat("soulCount", -0.5f); Instantiate(goodSkully, location, Quaternion.Euler(new Vector3(0, 0, 0))); } else // bad { PlayerPrefs.SetFloat("soulCount", 0.5f); Instantiate(badSkully, location, Quaternion.Euler(new Vector3(0, 0, 0))); } }
void OnTriggerEnter(Collider other) { if (entered || other.name != "Player") { return; } entered = true; StartCoroutine(DisplayText()); PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>(); grimInfo info = other.gameObject.GetComponent <grimInfo>(); if (info.soulCount < 0) // good { phys.hasEvilAttack = false; phys.hasGoodAttack = true; } else // bad { phys.hasEvilAttack = true; phys.hasGoodAttack = false; } }
public void Start() { if (camera == null) { camera = GameObject.FindGameObjectWithTag("MainCamera"); } platformer = GetComponent <PlatformerPhysics>(); StartCoroutine(footsteps()); audios = camera.GetComponents <AudioSource>(); if (audios.Length == 1) { audios[0].loop = true; audios[0].Play(); } else if (audios.Length == 4) { // when there are 4 background tracks for (int i = 0; i < 4; i++) { audios[i].mute = true; audios[i].Play(); } } }
// Use this for initialization void Awake() { platformer = GetComponent<PlatformerPhysics>(); #region Controls if (ControlScheme == null) { ControlScheme = ControlScheme.CreateScheme<JazzClimbingPlayerActions>(); // Make this into a nice function ControlScheme.Actions[(int)JazzClimbingPlayerActions.Jump].Keys.Add(ControlKey.PCKey(KeyCode.Space)); ControlScheme.Actions[(int)JazzClimbingPlayerActions.Jump].Keys.Add(ControlKey.XboxButton(XboxCtrlrInput.XboxButton.A)); ControlScheme.Actions[(int)JazzClimbingPlayerActions.PlayInstrument].Keys.Add(ControlKey.PCKey(KeyCode.E)); ControlScheme.Actions[(int)JazzClimbingPlayerActions.PlayInstrument].Keys.Add(ControlKey.XboxButton(XboxCtrlrInput.XboxButton.B)); } ControlManager.Instance.ControlSchemes[0] = ControlScheme; DontDestroyOnLoad(ControlManager.Instance); #endregion }
private void Awake() { physics = GetComponent <PlatformerPhysics>(); }
// Use this for initialization void Start() { mPlayer = transform.gameObject.GetComponent <PlayerCombat>(); mPhysics = transform.gameObject.GetComponent <PlatformerPhysics>(); }
public EdgeCollisionInfo(PlatformerPhysics p) { physics = p; hits = new List <RaycastHit2D>(); }