public override bool OnUse(PhysicsProp prop) { if (!IsOwner) { return(false); } Grabable grabable = prop as Grabable; if (grabbed == null && grabbing == null) { Collider grabable_collider = grabable.GetComponent <Collider>(); float grabable_height = grabable_collider.bounds.size.y; grabbing = grabable; if (IsServer) { bool success = grabable.Pickup( grabber: context.gameObject, grab_offset: Vector3.up * (0.2f + (player.cc.height / 2f) + (grabable_height / 2f))); PickupCallback(success); } else { grabable.PickupOnServer( grabber_netId: networkId, grabber_moId: moving_player.GetMovingObjectIndex(), grab_offset: Vector3.up * (0.2f + (player.cc.height / 2f) + (grabable_height / 2f))); grab_timeout_coroutine = utils.WaitAndRun( seconds: grab_timeout, action: () => { grabbing = null; }); } } return(false); }
public override void OnTriggerStay(Collider other, PhysicsProp prop) { if (!IsOwner) { return; } currentWater = prop as Water; player.SetSwimming(); }
public override void OnWallHit(Vector3 normal, Vector3 point, GameObject go, PhysicsProp prop) { if (!IsOwner) { return; } PreviousWallNormal = normal; PreviousWallPos = point; PreviousWall = prop as Climbable; utils.ResetTimer(CLIMB_TIMER); }
public override void OnTriggerStay(Collider other, PhysicsProp prop) { if (!IsOwner) { return; } CurrentLauncher = prop as Launcher; if (!CurrentLauncher.activated) { return; } utils.ResetTimer(LAUNCH_TIMER); }
public override void OnTriggerEnter(Collider other, PhysicsProp prop) { if (!IsOwner) { return; } if (!(prop as Launcher).activated) { return; } if (!utils.CheckTimer(LAUNCH_TIMER)) { return; } InitialPlayerVelocity = player.GetVelocity(); }
public override void OnTriggerStay(Collider other, PhysicsProp prop) { if (!isOwner) { return; } Pushable pushable = prop as Pushable; Vector3 motion_vector = player.GetMoveVector(); RaycastHit hit; if (Physics.Raycast(context.transform.position, motion_vector, out hit, player.cc.radius * 1.5f)) { // Avoid pushing if we are angled away from the surface if (Vector3.Dot(motion_vector, -hit.normal) < 0.8f) { return; } // Reset the push start buildup if we are no longer pushing if (utils.CheckTimer(PUSH_TIMER)) { utils.ResetTimer(PUSH_START_TIMER); } if (utils.CheckTimer(PUSH_START_TIMER)) { if (isServer) { pushable.Push(Vector3.Project(player.GetVelocity() - pushable.rigidbody.velocity, -hit.normal), true); } else { pushable.PushOnServer(-hit.normal * 12f); } } lastpushsurface = hit.normal; // We are not pushing if the analog is not being moved float move_mag = input_manager.GetMove().magnitude; if (move_mag > 0.5f) { utils.ResetTimer(PUSH_TIMER); } } }
// A return value of true "hides" the regular use behavior of the player controller public virtual bool OnUse(PhysicsProp prop) { return(false); }
public virtual void OnControllerColliderHit(ControllerColliderHit hit, PhysicsProp prop) { }
public virtual void OnCollisionExit(Collision other, PhysicsProp prop) { }
public virtual void OnTriggerExit(Collider other, PhysicsProp prop) { }
public virtual void OnWallHit(Vector3 normal, Vector3 point, GameObject go, PhysicsProp prop) { }