private void OnTriggerEnter(Collider other) { var player = other.GetComponent <PlayerController>(); if (player != null) { player.WarpToLastGroundedPosition(); Damage.ApplyGenericDamage(player.gameObject, 2); } }
public override void AddToCollection(ItemCollection collection) { var character = collection.GetComponent <Character>(); if (character != null) { base.AddToCollection(collection); Damage.ApplyGenericDamage(character.gameObject, -4); } }
private void OnCollisionEnter(Collision collision) { var player = collision.collider.GetComponent <PlayerController>(); if (player != null) { var direction = _target.transform.position - transform.position; direction.y = 0; direction.Normalize(); Damage.ApplyGenericDamage(player.gameObject, 2, this.gameObject); player.Movement.Knockback(direction * 15); _movement.Knockback(-direction * 15); } }
private void OnTriggerEnter(Collider other) { var player = other.GetComponent <PlayerController>(); if (player != null) { if (player.CanDamage) { // TODO: implement knockback system to handle this. var direction = (player.transform.position - transform.position).normalized; direction = (direction + transform.forward * 3).normalized; player.Movement.Knockback(direction * 30); } } Damage.ApplyGenericDamage(other.gameObject, 4); }
private void Update() { if (_player.GamePaused) { return; } var h = Input.GetAxis(HORIZONTAL_AXIS); var v = Input.GetAxis(VERTICAL_AXIS); var direction = new Vector3(h, 0, v); if (direction.magnitude > 1) { direction.Normalize(); } _player.Movement.Move(direction); if (Input.GetButtonDown(STRIKE)) { _player.Strike(); } if (Input.GetButtonDown(INTERACT)) { _player.Interact(); } if (Input.GetButtonDown(SHOOT)) { _player.FireArrow(); } if (Input.GetButtonDown(PAUSE)) { _player.Pause(); } #if UNITY_WEBGL if (Input.GetKeyDown(KeyCode.P)) { _player.Pause(); } #endif #if DEBUG if (Input.GetKeyDown(KeyCode.Q)) { Damage.ApplyGenericDamage(_player.gameObject, 20); } #endif }